home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / gd25s.zip / TEXINFO.TEX (.txt) < prev    next >
LaTeX Document  |  1993-10-08  |  137KB  |  3,229 lines

  1. %% TeX macros to handle texinfo files
  2. %   Copyright (C) 1985, 86, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
  3. %This texinfo.tex file is free software; you can redistribute it and/or
  4. %modify it under the terms of the GNU General Public License as
  5. %published by the Free Software Foundation; either version 2, or (at
  6. %your option) any later version.
  7. %This texinfo.tex file is distributed in the hope that it will be
  8. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  9. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  10. %General Public License for more details.
  11. %You should have received a copy of the GNU General Public License
  12. %along with this texinfo.tex file; see the file COPYING.  If not, write
  13. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  14. %USA.
  15. %In other words, you are welcome to use, share and improve this program.
  16. %You are forbidden to forbid anyone else to use, share and improve
  17. %what you give them.   Help stamp out software-hoarding!
  18. \def\texinfoversion{2.114}
  19. \message{Loading texinfo package [Version \texinfoversion]:}
  20. % Print the version number if in a .fmt file.
  21. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  22. % Save some parts of plain tex whose names we will redefine.
  23. \let\ptexlbrace=\{
  24. \let\ptexrbrace=\}
  25. \let\ptexdots=\dots
  26. \let\ptexdot=\.
  27. \let\ptexstar=\*
  28. \let\ptexend=\end
  29. \let\ptexbullet=\bullet
  30. \let\ptexb=\b
  31. \let\ptexc=\c
  32. \let\ptexi=\i
  33. \let\ptext=\t
  34. \let\ptexl=\l
  35. \let\ptexL=\L
  36. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  37. \message{Basics,}
  38. \chardef\other=12
  39. % If this character appears in an error message or help string, it
  40. % starts a new line in the output.
  41. \newlinechar = `^^J
  42. % Ignore a token.
  43. \def\gobble#1{}
  44. \hyphenation{ap-pen-dix}
  45. \hyphenation{mini-buf-fer mini-buf-fers}
  46. \hyphenation{eshell}
  47. % Margin to add to right of even pages, to left of odd pages.
  48. \newdimen \bindingoffset  \bindingoffset=0pt
  49. \newdimen \normaloffset   \normaloffset=\hoffset
  50. \newdimen\pagewidth \newdimen\pageheight
  51. \pagewidth=\hsize \pageheight=\vsize
  52. % Sometimes it is convenient to have everything in the transcript file
  53. % and nothing on the terminal.  We don't just call \tracingall here,
  54. % since that produces some useless output on the terminal.
  55. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  56. \def\loggingall{\tracingcommands2 \tracingstats2
  57.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  58.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  59.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  60. %---------------------Begin change-----------------------
  61. %%%% For @cropmarks command.
  62. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  63. \newdimen\cornerlong \newdimen\cornerthick
  64. \newdimen \topandbottommargin
  65. \newdimen \outerhsize \newdimen \outervsize
  66. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  67. \outerhsize=7in
  68. %\outervsize=9.5in
  69. % Alternative @smallbook page size is 9.25in
  70. \outervsize=9.25in
  71. \topandbottommargin=.75in
  72. %---------------------End change-----------------------
  73. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  74. % does insertions itself, but you have to call it yourself.
  75. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  76. \def\onepageout#1{\hoffset=\normaloffset
  77. \ifodd\pageno  \advance\hoffset by \bindingoffset
  78. \else \advance\hoffset by -\bindingoffset\fi
  79. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  80. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  81. {\let\hsize=\pagewidth \makefootline}}}%
  82. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  83. %%%% For @cropmarks command %%%%
  84. % Here is a modification of the main output routine for Near East Publications
  85. % This provides right-angle cropmarks at all four corners.
  86. % The contents of the page are centerlined into the cropmarks,
  87. % and any desired binding offset is added as an \hskip on either
  88. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  89. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  90. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  91.          \shipout
  92.          \vbox to \outervsize{\hsize=\outerhsize
  93.                  \vbox{\line{\ewtop\hfill\ewtop}}
  94.                  \nointerlineskip
  95.                  \line{\vbox{\moveleft\cornerthick\nstop}
  96.                        \hfill
  97.                        \vbox{\moveright\cornerthick\nstop}}
  98.                  \vskip \topandbottommargin
  99.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  100.             \vbox{
  101.             {\let\hsize=\pagewidth \makeheadline}
  102.             \pagebody{#1}
  103.             {\let\hsize=\pagewidth \makefootline}}
  104.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  105.          \vskip \topandbottommargin plus1fill minus1fill
  106.                  \boxmaxdepth\cornerthick
  107.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  108.                        \hfill
  109.                        \vbox{\moveright\cornerthick\nsbot}}
  110.                  \nointerlineskip
  111.                  \vbox{\line{\ewbot\hfill\ewbot}}
  112.   \advancepageno
  113.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  114. % Do @cropmarks to get crop marks
  115. \def\cropmarks{\let\onepageout=\croppageout }
  116. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  117. {\catcode`\@ =11
  118. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  119. \dimen@=\dp#1 \unvbox#1
  120. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  121. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  122. % Here are the rules for the cropmarks.  Note that they are
  123. % offset so that the space between them is truly \outerhsize or \outervsize
  124. % (P. A. MacKay, 12 November, 1986)
  125. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  126. \def\nstop{\vbox
  127.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  128. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  129. \def\nsbot{\vbox
  130.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  131. % Parse an argument, then pass it to #1.  The argument is the rest of
  132. % the input line (except we remove a trailing comment).  #1 should be a
  133. % macro which expects an ordinary undelimited TeX argument.
  134. \def\parsearg#1{%
  135.   \let\next = #1%
  136.   \begingroup
  137.     \obeylines
  138.     \futurelet\temp\parseargx
  139. % If the next token is an obeyed space (from an @example environment or
  140. % the like), remove it and recurse.  Otherwise, we're done.
  141. \def\parseargx{%
  142.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  143.   \ifx\obeyedspace\temp
  144.     \expandafter\parseargdiscardspace
  145.   \else
  146.     \expandafter\parseargline
  147.   \fi
  148. % Remove a single space (as the delimiter token to the macro call).
  149. {\obeyspaces %
  150.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  151. {\obeylines %
  152.   \gdef\parseargline#1^^M{%
  153.     \endgroup % End of the group started in \parsearg.
  154.     %
  155.     % First remove any @c comment, then any @comment.
  156.     % Result of each macro is put in \toks0.
  157.     \argremovec #1\c\relax %
  158.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  159.     %
  160.     % Call the caller's macro, saved as \next in \parsearg.
  161.     \expandafter\next\expandafter{\the\toks0}%
  162. % Since all \c{,omment} does is throw away the argument, we can let TeX
  163. % do that for us.  The \relax here is matched by the \relax in the call
  164. % in \parseargline; it could be more or less anything, its purpose is
  165. % just to delimit the argument to the \c.
  166. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  167. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  168. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  169. %    @end itemize  @c foo
  170. % will have two active spaces as part of the argument with the
  171. % `itemize'.  Here we remove all active spaces from #1, and assign the
  172. % result to \toks0.
  173. % This loses if there are any *other* active characters besides spaces
  174. % in the argument -- _ ^ +, for example -- since they get expanded.
  175. % Fortunately, Texinfo does not define any such commands.  (If it ever
  176. % does, the catcode of the characters in questionwill have to be changed
  177. % here.)  But this means we cannot call \removeactivespaces as part of
  178. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  179. % that \parsearg gets might well have any character at all in it.
  180. \def\removeactivespaces#1{%
  181.   \begingroup
  182.     \ignoreactivespaces
  183.     \edef\temp{#1}%
  184.     \global\toks0 = \expandafter{\temp}%
  185.   \endgroup
  186. % Change the active space to expand to nothing.
  187. \begingroup
  188.   \obeyspaces
  189.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  190. \endgroup
  191. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  192. %% These are used to keep @begin/@end levels from running away
  193. %% Call \inENV within environments (after a \begingroup)
  194. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  195. \def\ENVcheck{%
  196. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  197. \endgroup\fi} % This is not perfect, but it should reduce lossage
  198. % @begin foo  is the same as @foo, for now.
  199. \newhelp\EMsimple{Type <Return> to continue.}
  200. \outer\def\begin{\parsearg\beginxxx}
  201. \def\beginxxx #1{%
  202. \expandafter\ifx\csname #1\endcsname\relax
  203. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  204. \csname #1\endcsname\fi}
  205. % @end foo executes the definition of \Efoo.
  206. \def\end{\parsearg\endxxx}
  207. \def\endxxx #1{%
  208.   \removeactivespaces{#1}%
  209.   \edef\endthing{\the\toks0}%
  210.   \expandafter\ifx\csname E\endthing\endcsname\relax
  211.     \expandafter\ifx\csname \endthing\endcsname\relax
  212.       % There's no \foo, i.e., no ``environment'' foo.
  213.       \errhelp = \EMsimple
  214.       \errmessage{Undefined command `@end \endthing'}%
  215.     \else
  216.       \unmatchedenderror\endthing
  217.     \fi
  218.   \else
  219.     % Everything's ok; the right environment has been started.
  220.     \csname E\endthing\endcsname
  221.   \fi
  222. % There is an environment #1, but it hasn't been started.  Give an error.
  223. \def\unmatchedenderror#1{%
  224.   \errhelp = \EMsimple
  225.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  226. % Define the control sequence \E#1 to give an unmatched @end error.
  227. \def\defineunmatchedend#1{%
  228.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  229. % Single-spacing is done by various environments (specifically, in
  230. % \nonfillstart and \quotations).
  231. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  232. \def\singlespace{%
  233. % Why was this kern here?  It messes up equalizing space above and below
  234. % environments.  --karl, 6may93
  235. %{\advance \baselineskip by -\singlespaceskip
  236. %\kern \baselineskip}%
  237. \baselineskip=\singlespaceskip
  238. %% Simple single-character @ commands
  239. % @@ prints an @
  240. % Kludge this until the fonts are right (grr).
  241. \def\@{{\tt \char '100}}
  242. % This is turned off because it was never documented
  243. % and you can use @w{...} around a quote to suppress ligatures.
  244. %% Define @` and @' to be the same as ` and '
  245. %% but suppressing ligatures.
  246. %\def\`{{`}}
  247. %\def\'{{'}}
  248. % Used to generate quoted braces.
  249. \def\mylbrace {{\tt \char '173}}
  250. \def\myrbrace {{\tt \char '175}}
  251. \let\{=\mylbrace
  252. \let\}=\myrbrace
  253. % @: forces normal size whitespace following.
  254. \def\:{\spacefactor=1000 }
  255. % @* forces a line break.
  256. \def\*{\hfil\break\hbox{}\ignorespaces}
  257. % @. is an end-of-sentence period.
  258. \def\.{.\spacefactor=3000 }
  259. % @w prevents a word break.  Without the \leavevmode, @w at the
  260. % beginning of a paragraph, when TeX is still in vertical mode, would
  261. % produce a whole line of output instead of starting the paragraph.
  262. \def\w#1{\leavevmode\hbox{#1}}
  263. % @group ... @end group forces ... to be all on one page, by enclosing
  264. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  265. % to keep its height that of a normal line.  According to the rules for
  266. % \topskip (p.114 of the TeXbook), the glue inserted is
  267. % max (\topskip - \ht (first item), 0).  If that height is large,
  268. % therefore, no glue is inserted, and the space between the headline and
  269. % the text is small, which looks bad.
  270. \def\group{\begingroup
  271.   \ifnum\catcode13=\active \else
  272.     \errhelp = \groupinvalidhelp
  273.     \errmessage{@group invalid in context where filling is enabled}%
  274.   \fi
  275.   % The \vtop we start below produces a box with normal height and large
  276.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  277.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  278.   % the TeXbook.)  Thus, space below is not quite equal to space
  279.   % above.  But it's pretty close.
  280.   \def\Egroup{%
  281.     \egroup           % End the \vtop.
  282.     \endgroup         % End the \group.
  283.   \vtop\bgroup
  284.     % We have to put a strut on the last line in case the @group is in
  285.     % the midst of an example, rather than completely enclosing it.
  286.     % Otherwise, the interline space between the last line of the group
  287.     % and the first line afterwards is too small.  But we can't put the
  288.     % strut in \Egroup, since there it would be on a line by itself.
  289.     % Hence this just inserts a strut at the beginning of each line.
  290.     \everypar = {\strut}%
  291.     %
  292.     % Since we have a strut on every line, we don't need any of TeX's
  293.     % normal interline spacing.
  294.     \offinterlineskip
  295.     %
  296.     % OK, but now we have to do something about blank
  297.     % lines in the input in @example-like environments, which normally
  298.     % just turn into \lisppar, which will insert no space now that we've
  299.     % turned off the interline space.  Simplest is to make them be an
  300.     % empty paragraph.
  301.     \ifx\par\lisppar
  302.       \edef\par{\leavevmode \par}%
  303.       %
  304.       % Reset ^^M's definition to new definition of \par.
  305.       \obeylines
  306.     \fi
  307.     %
  308.     % We do @comment here in case we are called inside an environment,
  309.     % such as @example, where each end-of-line in the input causes an
  310.     % end-of-line in the output.  We don't want the end-of-line after
  311.     % the `@group' to put extra space in the output.  Since @group
  312.     % should appear on a line by itself (according to the Texinfo
  313.     % manual), we don't worry about eating any user text.
  314.     \comment
  315. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  316. % message, so this ends up printing `@group can only ...'.
  317. \newhelp\groupinvalidhelp{%
  318. group can only be used in environments such as @example,^^J%
  319. where each line of input produces a line of output.}
  320. % @need space-in-mils
  321. % forces a page break if there is not space-in-mils remaining.
  322. \newdimen\mil  \mil=0.001in
  323. \def\need{\parsearg\needx}
  324. % Old definition--didn't work.
  325. %\def\needx #1{\par %
  326. %% This method tries to make TeX break the page naturally
  327. %% if the depth of the box does not fit.
  328. %{\baselineskip=0pt%
  329. %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  330. %\prevdepth=-1000pt
  331. \def\needx#1{%
  332.   % Go into vertical mode, so we don't make a big box in the middle of a
  333.   % paragraph.
  334.   \par
  335.   % Don't add any leading before our big empty box, but allow a page
  336.   % break, since the best break might be right here.
  337.   \allowbreak
  338.   \nointerlineskip
  339.   \vtop to #1\mil{\vfil}%
  340.   % TeX does not even consider page breaks if a penalty added to the
  341.   % main vertical list is 10000 or more.  But in order to see if the
  342.   % empty box we just added fits on the page, we must make it consider
  343.   % page breaks.  On the other hand, we don't want to actually break the
  344.   % page after the empty box.  So we use a penalty of 9999.
  345.   % There is an extremely small chance that TeX will actually break the
  346.   % page at this \penalty, if there are no other feasible breakpoints in
  347.   % sight.  (If the user is using lots of big @group commands, which
  348.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  349.   % good page breaking, for example.)  However, I could not construct an
  350.   % example where a page broke at this \penalty; if it happens in a real
  351.   % document, then we can reconsider our strategy.
  352.   \penalty9999
  353.   % Back up by the size of the box, whether we did a page break or not.
  354.   \kern -#1\mil
  355.   % Do not allow a page break right after this kern.
  356.   \nobreak
  357. % @br   forces paragraph break
  358. \let\br = \par
  359. % @dots{}  output some dots
  360. \def\dots{$\ldots$}
  361. % @page    forces the start of a new page
  362. \def\page{\par\vfill\supereject}
  363. % @exdent text....
  364. % outputs text on separate line in roman font, starting at standard page margin
  365. % This records the amount of indent in the innermost environment.
  366. % That's how much \exdent should take out.
  367. \newskip\exdentamount
  368. % This defn is used inside fill environments such as @defun.
  369. \def\exdent{\parsearg\exdentyyy}
  370. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  371. % This defn is used inside nofill environments such as @example.
  372. \def\nofillexdent{\parsearg\nofillexdentyyy}
  373. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  374. \leftline{\hskip\leftskip{\rm#1}}}}
  375. %\hbox{{\rm#1}}\hfil\break}}
  376. % @include file    insert text of that file as input.
  377. \def\include{\parsearg\includezzz}
  378. %Use \input\thisfile to avoid blank after \input, which may be an active
  379. %char (in which case the blank would become the \input argument).
  380. %The grouping keeps the value of \thisfile correct even when @include
  381. %is nested.
  382. \def\includezzz #1{\begingroup
  383. \def\thisfile{#1}\input\thisfile
  384. \endgroup}
  385. \def\thisfile{}
  386. % @center line   outputs that line, centered
  387. \def\center{\parsearg\centerzzz}
  388. \def\centerzzz #1{{\advance\hsize by -\leftskip
  389. \advance\hsize by -\rightskip
  390. \centerline{#1}}}
  391. % @sp n   outputs n lines of vertical space
  392. \def\sp{\parsearg\spxxx}
  393. \def\spxxx #1{\par \vskip #1\baselineskip}
  394. % @comment ...line which is ignored...
  395. % @c is the same as @comment
  396. % @ignore ... @end ignore  is another way to write a comment
  397. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  398. \parsearg \commentxxx}
  399. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  400. \let\c=\comment
  401. % Prevent errors for section commands.
  402. % Used in @ignore and in failing conditionals.
  403. \def\ignoresections{%
  404. \let\chapter=\relax
  405. \let\unnumbered=\relax
  406. \let\top=\relax
  407. \let\unnumberedsec=\relax
  408. \let\unnumberedsection=\relax
  409. \let\unnumberedsubsec=\relax
  410. \let\unnumberedsubsection=\relax
  411. \let\unnumberedsubsubsec=\relax
  412. \let\unnumberedsubsubsection=\relax
  413. \let\section=\relax
  414. \let\subsec=\relax
  415. \let\subsubsec=\relax
  416. \let\subsection=\relax
  417. \let\subsubsection=\relax
  418. \let\appendix=\relax
  419. \let\appendixsec=\relax
  420. \let\appendixsection=\relax
  421. \let\appendixsubsec=\relax
  422. \let\appendixsubsection=\relax
  423. \let\appendixsubsubsec=\relax
  424. \let\appendixsubsubsection=\relax
  425. \let\contents=\relax
  426. \let\smallbook=\relax
  427. \let\titlepage=\relax
  428. % Used in nested conditionals, where we have to parse the Texinfo source
  429. % and so want to turn off most commands, in case they are used
  430. % incorrectly.
  431. \def\ignoremorecommands{%
  432.   \let\defcv = \relax
  433.   \let\deffn = \relax
  434.   \let\deffnx = \relax
  435.   \let\defindex = \relax
  436.   \let\defivar = \relax
  437.   \let\defmac = \relax
  438.   \let\defmethod = \relax
  439.   \let\defop = \relax
  440.   \let\defopt = \relax
  441.   \let\defspec = \relax
  442.   \let\deftp = \relax
  443.   \let\deftypefn = \relax
  444.   \let\deftypefun = \relax
  445.   \let\deftypevar = \relax
  446.   \let\deftypevr = \relax
  447.   \let\defun = \relax
  448.   \let\defvar = \relax
  449.   \let\defvr = \relax
  450.   \let\ref = \relax
  451.   \let\xref = \relax
  452.   \let\printindex = \relax
  453.   \let\pxref = \relax
  454.   \let\settitle = \relax
  455.   \let\include = \relax
  456.   \let\lowersections = \relax
  457.   \let\down = \relax
  458.   \let\raisesections = \relax
  459.   \let\up = \relax
  460.   \let\set = \relax
  461.   \let\clear = \relax
  462. % Ignore @ignore ... @end ignore.
  463. \def\ignore{\doignore{ignore}}
  464. % Also ignore @ifinfo, @menu, and @direntry text.
  465. \def\ifinfo{\doignore{ifinfo}}
  466. \def\menu{\doignore{menu}}
  467. \def\direntry{\doignore{direntry}}
  468. % Ignore text until a line `@end #1'.
  469. \def\doignore#1{\begingroup
  470.   % Don't complain about control sequences we have declared \outer.
  471.   \ignoresections
  472.   % Define a command to swallow text until we reach `@end #1'.
  473.   \long\def\doignoretext##1\end #1{\enddoignore}%
  474.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  475.   \catcode32 = 10
  476.   % And now expand that command.
  477.   \doignoretext
  478. % What we do to finish off ignored text.
  479. \def\enddoignore{\endgroup\ignorespaces}%
  480. \newif\ifwarnedobs\warnedobsfalse
  481. \def\obstexwarn{%
  482.   \ifwarnedobs\relax\else
  483.   % We need to warn folks that they may have trouble with TeX 3.0.
  484.   % This uses \immediate\write16 rather than \message to get newlines.
  485.     \immediate\write16{}
  486.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  487.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  488.     \immediate\write16{If you are running another version of TeX, relax.}
  489.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  490.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  491.     \immediate\write16{If you are stuck with version 3.0, run the}
  492.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  493.     \immediate\write16{  to use a workaround.}
  494.     \immediate\write16{}
  495.     \warnedobstrue
  496.     \fi
  497. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  498. % workaround (which requires the file ``dummy.tfm'' to be installed),
  499. % uncomment the following line:
  500. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  501. % Ignore text, except that we keep track of conditional commands for
  502. % purposes of nesting, up to an `@end #1' command.
  503. \def\nestedignore#1{%
  504.   \obstexwarn
  505.   % We must actually expand the ignored text to look for the @end
  506.   % command, so that nested ignore constructs work.  Thus, we put the
  507.   % text into a \vbox and then do nothing with the result.  To minimize
  508.   % the change of memory overflow, we follow the approach outlined on
  509.   % page 401 of the TeXbook: make the current font be a dummy font.
  510.   \setbox0 = \vbox\bgroup
  511.     % Don't complain about control sequences we have declared \outer.
  512.     \ignoresections
  513.     %
  514.     % Define `@end #1' to end the box, which will in turn undefine the
  515.     % @end command again.
  516.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  517.     %
  518.     % We are going to be parsing Texinfo commands.  Most cause no
  519.     % trouble when they are used incorrectly, but some commands do
  520.     % complicated argument parsing or otherwise get confused, so we
  521.     % undefine them.
  522.     %
  523.     % We can't do anything about stray @-signs, unfortunately;
  524.     % they'll produce `undefined control sequence' errors.
  525.     \ignoremorecommands
  526.     %
  527.     % Set the current font to be \nullfont, a TeX primitive, and define
  528.     % all the font commands to also use \nullfont.  We don't use
  529.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  530.     % might have that installed.  Therefore, math mode will still
  531.     % produce output, but that should be an extremely small amount of
  532.     % stuff compared to the main input.
  533.     %
  534.     \nullfont
  535.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  536.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  537.     \let\tensf = \nullfont
  538.     % Similarly for index fonts (mostly for their use in
  539.     % smallexample)
  540.     \let\indrm = \nullfont  \let\indit = \nullfont  \let\indsl = \nullfont
  541.     \let\indbf = \nullfont  \let\indtt = \nullfont  \let\indsc = \nullfont
  542.     \let\indsf = \nullfont
  543.     %
  544.     % Don't complain when characters are missing from the fonts.
  545.     \tracinglostchars = 0
  546.     %
  547.     % Don't bother to do space factor calculations.
  548.     \frenchspacing
  549.     %
  550.     % Don't report underfull hboxes.
  551.     \hbadness = 10000
  552.     %
  553.     % Do minimal line-breaking.
  554.     \pretolerance = 10000
  555.     %
  556.     % Do not execute instructions in @tex
  557.     \def\tex{\doignore{tex}}
  558. % @set VAR sets the variable VAR to an empty value.
  559. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  560. % Since we want to separate VAR from REST-OF-LINE (which might be
  561. % empty), we can't just use \parsearg; we have to insert a space of our
  562. % own to delimit the rest of the line, and then take it out again if we
  563. % didn't need it.
  564. \def\set{\parsearg\setxxx}
  565. \def\setxxx#1{\setyyy#1 \endsetyyy}
  566. \def\setyyy#1 #2\endsetyyy{%
  567.   \def\temp{#2}%
  568.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  569.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  570.   \fi
  571. \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
  572. % @clear VAR clears (i.e., unsets) the variable VAR.
  573. \def\clear{\parsearg\clearxxx}
  574. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  575. % @value{foo} gets the text saved in variable foo.
  576. \def\value#1{\expandafter
  577.         \ifx\csname SET#1\endcsname\relax
  578.             {\{No value for ``#1''\}}
  579.         \else \csname SET#1\endcsname \fi}
  580. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  581. % with @set.
  582. \def\ifset{\parsearg\ifsetxxx}
  583. \def\ifsetxxx #1{%
  584.   \expandafter\ifx\csname SET#1\endcsname\relax
  585.     \expandafter\ifsetfail
  586.   \else
  587.     \expandafter\ifsetsucceed
  588.   \fi
  589. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  590. \def\ifsetfail{\nestedignore{ifset}}
  591. \defineunmatchedend{ifset}
  592. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  593. % defined with @set, or has been undefined with @clear.
  594. \def\ifclear{\parsearg\ifclearxxx}
  595. \def\ifclearxxx #1{%
  596.   \expandafter\ifx\csname SET#1\endcsname\relax
  597.     \expandafter\ifclearsucceed
  598.   \else
  599.     \expandafter\ifclearfail
  600.   \fi
  601. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  602. \def\ifclearfail{\nestedignore{ifclear}}
  603. \defineunmatchedend{ifclear}
  604. % @iftex always succeeds; we read the text following, through @end
  605. % iftex).  But `@end iftex' should be valid only after an @iftex.
  606. \def\iftex{\conditionalsucceed{iftex}}
  607. \defineunmatchedend{iftex}
  608. % We can't just want to start a group at @iftex (for example) and end it
  609. % at @end iftex, since then @set commands inside the conditional have no
  610. % effect (they'd get reverted at the end of the group).  So we must
  611. % define \Eiftex to redefine itself to be its previous value.  (We can't
  612. % just define it to fail again with an ``unmatched end'' error, since
  613. % the @ifset might be nested.)
  614. \def\conditionalsucceed#1{%
  615.   \edef\temp{%
  616.     % Remember the current value of \E#1.
  617.     \let\nece{prevE#1} = \nece{E#1}%
  618.     %
  619.     % At the `@end #1', redefine \E#1 to be its previous value.
  620.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  621.   \temp
  622. % We need to expand lots of \csname's, but we don't want to expand the
  623. % control sequences after we've constructed them.
  624. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  625. % @asis just yields its argument.  Used with @table, for example.
  626. \def\asis#1{#1}
  627. % @math means output in math mode.
  628. % We don't use $'s directly in the definition of \math because control
  629. % sequences like \math are expanded when the toc file is written.  Then,
  630. % we read the toc file back, the $'s will be normal characters (as they
  631. % should be, according to the definition of Texinfo).  So we must use a
  632. % control sequence to switch into and out of math mode.
  633. % This isn't quite enough for @math to work properly in indices, but it
  634. % seems unlikely it will ever be needed there.
  635. \let\implicitmath = $
  636. \def\math#1{\implicitmath #1\implicitmath}
  637. % @bullet and @minus need the same treatment as @math, just above.
  638. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  639. \def\minus{\implicitmath-\implicitmath}
  640. \def\node{\ENVcheck\parsearg\nodezzz}
  641. \def\nodezzz#1{\nodexxx [#1,]}
  642. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  643. \let\nwnode=\node
  644. \let\lastnode=\relax
  645. \def\donoderef{\ifx\lastnode\relax\else
  646. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  647. \let\lastnode=\relax}
  648. \def\unnumbnoderef{\ifx\lastnode\relax\else
  649. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  650. \let\lastnode=\relax}
  651. \def\appendixnoderef{\ifx\lastnode\relax\else
  652. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  653. \let\lastnode=\relax}
  654. \let\refill=\relax
  655. % @setfilename is done at the beginning of every texinfo file.
  656. % So open here the files we need to have open while reading the input.
  657. % This makes it possible to make a .fmt file for texinfo.
  658. \def\setfilename{%
  659.    \readauxfile
  660.    \opencontents
  661.    \openindices
  662.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  663.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  664.    \comment % Ignore the actual filename.
  665. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  666. \def\inforef #1{\inforefzzz #1,,,,**}
  667. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\ignorespaces #3{}},
  668.   node \samp{\ignorespaces#1{}}}
  669. \message{fonts,}
  670. % Font-change commands.
  671. % Texinfo supports the sans serif font style, which plain TeX does not.
  672. % So we set up a \sf analogous to plain's \rm, etc.
  673. \newfam\sffam
  674. \def\sf{\fam=\sffam \tensf}
  675. \let\li = \sf % Sometimes we call it \li, not \sf.
  676. %% Try out Computer Modern fonts at \magstephalf
  677. \let\mainmagstep=\magstephalf
  678. \ifx\bigger\relax
  679. \let\mainmagstep=\magstep1
  680. \font\textrm=cmr12
  681. \font\texttt=cmtt12
  682. \else
  683. \font\textrm=cmr10 scaled \mainmagstep
  684. \font\texttt=cmtt10 scaled \mainmagstep
  685. % Instead of cmb10, you many want to use cmbx10.
  686. % cmbx10 is a prettier font on its own, but cmb10
  687. % looks better when embedded in a line with cmr10.
  688. \font\textbf=cmb10 scaled \mainmagstep
  689. \font\textit=cmti10 scaled \mainmagstep
  690. \font\textsl=cmsl10 scaled \mainmagstep
  691. \font\textsf=cmss10 scaled \mainmagstep
  692. \font\textsc=cmcsc10 scaled \mainmagstep
  693. \font\texti=cmmi10 scaled \mainmagstep
  694. \font\textsy=cmsy10 scaled \mainmagstep
  695. % A few fonts for @defun, etc.
  696. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  697. \font\deftt=cmtt10 scaled \magstep1
  698. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  699. % Fonts for indices and small examples.
  700. % We actually use the slanted font rather than the italic,
  701. % because texinfo normally uses the slanted fonts for that.
  702. % Do not make many font distinctions in general in the index, since they
  703. % aren't very useful.
  704. \font\ninett=cmtt9
  705. \font\indrm=cmr9
  706. \font\indit=cmsl9
  707. \let\indsl=\indit
  708. \let\indtt=\ninett
  709. \let\indsf=\indrm
  710. \let\indbf=\indrm
  711. \let\indsc=\indrm
  712. \font\indi=cmmi9
  713. \font\indsy=cmsy9
  714. % Fonts for headings
  715. \font\chaprm=cmbx12 scaled \magstep2
  716. \font\chapit=cmti12 scaled \magstep2
  717. \font\chapsl=cmsl12 scaled \magstep2
  718. \font\chaptt=cmtt12 scaled \magstep2
  719. \font\chapsf=cmss12 scaled \magstep2
  720. \let\chapbf=\chaprm
  721. \font\chapsc=cmcsc10 scaled\magstep3
  722. \font\chapi=cmmi12 scaled \magstep2
  723. \font\chapsy=cmsy10 scaled \magstep3
  724. \font\secrm=cmbx12 scaled \magstep1
  725. \font\secit=cmti12 scaled \magstep1
  726. \font\secsl=cmsl12 scaled \magstep1
  727. \font\sectt=cmtt12 scaled \magstep1
  728. \font\secsf=cmss12 scaled \magstep1
  729. \font\secbf=cmbx12 scaled \magstep1
  730. \font\secsc=cmcsc10 scaled\magstep2
  731. \font\seci=cmmi12 scaled \magstep1
  732. \font\secsy=cmsy10 scaled \magstep2
  733. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  734. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  735. % \font\ssecsl=cmsl10 scaled \magstep1
  736. % \font\ssectt=cmtt10 scaled \magstep1
  737. % \font\ssecsf=cmss10 scaled \magstep1
  738. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  739. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  740. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  741. %\font\ssectt=cmtt10 scaled 1315
  742. %\font\ssecsf=cmss10 scaled 1315
  743. %\let\ssecbf=\ssecrm
  744. \font\ssecrm=cmbx12 scaled \magstephalf
  745. \font\ssecit=cmti12 scaled \magstephalf
  746. \font\ssecsl=cmsl12 scaled \magstephalf
  747. \font\ssectt=cmtt12 scaled \magstephalf
  748. \font\ssecsf=cmss12 scaled \magstephalf
  749. \font\ssecbf=cmbx12 scaled \magstephalf
  750. \font\ssecsc=cmcsc10 scaled \magstep1
  751. \font\sseci=cmmi12 scaled \magstephalf
  752. \font\ssecsy=cmsy10 scaled \magstep1
  753. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  754. % but that is not a standard magnification.
  755. % Fonts for title page:
  756. \font\titlerm = cmbx12 scaled \magstep3
  757. \let\authorrm = \secrm
  758. % In order for the font changes to affect most math symbols and letters,
  759. % we have to define the \textfont of the standard families.  Since
  760. % texinfo doesn't allow for producing subscripts and superscripts, we
  761. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  762. % also require loading a lot more fonts).
  763. \def\resetmathfonts{%
  764.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  765.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  766.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  767. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  768. % of just \STYLE.  We do this so that font changes will continue to work
  769. % in math mode, where it is the current \fam that is relevant in most
  770. % cases, not the current.  Plain TeX does, for example,
  771. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  772. % to redefine \bf itself.
  773. \def\textfonts{%
  774.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  775.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  776.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  777.   \resetmathfonts}
  778. \def\chapfonts{%
  779.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  780.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  781.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  782.   \resetmathfonts}
  783. \def\secfonts{%
  784.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  785.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  786.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  787.   \resetmathfonts}
  788. \def\subsecfonts{%
  789.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  790.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  791.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  792.   \resetmathfonts}
  793. \def\indexfonts{%
  794.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  795.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  796.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  797.   \resetmathfonts}
  798. % Set up the default fonts, so we can use them for creating boxes.
  799. \textfonts
  800. % Count depth in font-changes, for error checks
  801. \newcount\fontdepth \fontdepth=0
  802. % Fonts for short table of contents.
  803. \font\shortcontrm=cmr12
  804. \font\shortcontbf=cmbx12
  805. \font\shortcontsl=cmsl12
  806. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  807. %% serif) and @ii for TeX italic
  808. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  809. % unless the following character is such as not to need one.
  810. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  811. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  812. \let\i=\smartitalic
  813. \let\var=\smartitalic
  814. \let\dfn=\smartitalic
  815. \let\emph=\smartitalic
  816. \let\cite=\smartitalic
  817. \def\b#1{{\bf #1}}
  818. \let\strong=\b
  819. % We can't just use \exhyphenpenalty, because that only has effect at
  820. % the end of a paragraph.  Restore normal hyphenation at the end of the
  821. % group within which \nohyphenation is presumably called.
  822. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  823. \def\restorehyphenation{\hyphenchar\font = `- }
  824. \def\t#1{%
  825.   {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
  826.   \null
  827. \let\ttfont = \t
  828. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  829. \def\samp #1{`\tclose{#1}'\null}
  830. \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
  831. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  832. \let\file=\samp
  833. % @code is a modification of @t,
  834. % which makes spaces the same size as normal in the surrounding text.
  835. \def\tclose#1{%
  836.     % Change normal interword space to be same as for the current font.
  837.     \spaceskip = \fontdimen2\font
  838.     %
  839.     % Switch to typewriter.
  840.     \tt
  841.     %
  842.     % But `\ ' produces the large typewriter interword space.
  843.     \def\ {{\spaceskip = 0pt{} }}%
  844.     %
  845.     % Turn off hyphenation.
  846.     \nohyphenation
  847.     %
  848.     \rawbackslash
  849.     \frenchspacing
  850.     #1%
  851.   \null
  852. % We *must* turn on hyphenation at `-' and `_' in \code.
  853. % Otherwise, it is too hard to avoid overful hboxes
  854. % in the Emacs manual, the Library manual, etc.
  855. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  856. % both hyphenation at - and hyphenation within words.
  857. % We must therefore turn them both off (\tclose does that)
  858. % and arrange explicitly to hyphenate an a dash.
  859. %  -- rms.
  860. \catcode`\-=\active
  861. \catcode`\_=\active
  862. \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
  863. % The following is used by \doprintindex to insure that long function names
  864. % wrap around.  It is necessary for - and _ to be active before the index is
  865. % read from the file, as \entry parses the arguments long before \code is
  866. % ever called.  -- mycroft
  867. \global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
  868. \def\realdash{-}
  869. \def\realunder{_}
  870. \def\codedash{-\discretionary{}{}{}}
  871. \def\codeunder{\normalunderscore\discretionary{}{}{}}
  872. \def\codex #1{\tclose{#1}\endgroup}
  873. %\let\exp=\tclose  %Was temporary
  874. % @kbd is like @code, except that if the argument is just one @key command,
  875. % then @kbd has no effect.
  876. \def\xkey{\key}
  877. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  878. \ifx\one\xkey\ifx\threex\three \key{#2}%
  879. \else\tclose{\look}\fi
  880. \else\tclose{\look}\fi}
  881. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  882. % argument is to make the input look right: @dmn{pt} instead of
  883. % @dmn{}pt.
  884. \def\dmn#1{\thinspace #1}
  885. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  886. \def\l#1{{\li #1}\null}        %
  887. \def\r#1{{\rm #1}}        % roman font
  888. % Use of \lowercase was suggested.
  889. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  890. \def\ii#1{{\it #1}}        % italic font
  891. \message{page headings,}
  892. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  893. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  894. % First the title page.  Must do @settitle before @titlepage.
  895. \def\titlefont#1{{\titlerm #1}}
  896. \newif\ifseenauthor
  897. \newif\iffinishedtitlepage
  898. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  899. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  900.     \endgroup\page\hbox{}\page}
  901. \def\titlepage{\begingroup \parindent=0pt \textfonts
  902.    \let\subtitlerm=\tenrm
  903. % I deinstalled the following change because \cmr12 is undefined.
  904. % This change was not in the ChangeLog anyway.  --rms.
  905. %   \let\subtitlerm=\cmr12
  906.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  907.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  908.    % Leave some space at the very top of the page.
  909.    \vglue\titlepagetopglue
  910.    % Now you can print the title using @title.
  911.    \def\title{\parsearg\titlezzz}%
  912.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  913.             % print a rule at the page bottom also.
  914.             \finishedtitlepagefalse
  915.             \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  916.    % No rule at page bottom unless we print one at the top with @title.
  917.    \finishedtitlepagetrue
  918.    % Now you can put text using @subtitle.
  919.    \def\subtitle{\parsearg\subtitlezzz}%
  920.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  921.    % @author should come last, but may come many times.
  922.    \def\author{\parsearg\authorzzz}%
  923.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  924.       {\authorfont \leftline{##1}}}%
  925.    % Most title ``pages'' are actually two pages long, with space
  926.    % at the top of the second.  We don't want the ragged left on the second.
  927.    \let\oldpage = \page
  928.    \def\page{%
  929.       \iffinishedtitlepage\else
  930.      \finishtitlepage
  931.       \fi
  932.       \oldpage
  933.       \let\page = \oldpage
  934.       \hbox{}}%
  935. %   \def\page{\oldpage \hbox{}}
  936. \def\Etitlepage{%
  937.    \iffinishedtitlepage\else
  938.       \finishtitlepage
  939.    \fi
  940.    % It is important to do the page break before ending the group,
  941.    % because the headline and footline are only empty inside the group.
  942.    % If we use the new definition of \page, we always get a blank page
  943.    % after the title page, which we certainly don't want.
  944.    \oldpage
  945.    \endgroup
  946.    \HEADINGSon
  947. \def\finishtitlepage{%
  948.    \vskip4pt \hrule height 2pt width \hsize
  949.    \vskip\titlepagebottomglue
  950.    \finishedtitlepagetrue
  951. %%% Set up page headings and footings.
  952. \let\thispage=\folio
  953. \newtoks \evenheadline    % Token sequence for heading line of even pages
  954. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  955. \newtoks \evenfootline    % Token sequence for footing line of even pages
  956. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  957. % Now make Tex use those variables
  958. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  959.                             \else \the\evenheadline \fi}}
  960. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  961.                             \else \the\evenfootline \fi}\HEADINGShook}
  962. \let\HEADINGShook=\relax
  963. % Commands to set those variables.
  964. % For example, this is what  @headings on  does
  965. % @evenheading @thistitle|@thispage|@thischapter
  966. % @oddheading @thischapter|@thispage|@thistitle
  967. % @evenfooting @thisfile||
  968. % @oddfooting ||@thisfile
  969. \def\evenheading{\parsearg\evenheadingxxx}
  970. \def\oddheading{\parsearg\oddheadingxxx}
  971. \def\everyheading{\parsearg\everyheadingxxx}
  972. \def\evenfooting{\parsearg\evenfootingxxx}
  973. \def\oddfooting{\parsearg\oddfootingxxx}
  974. \def\everyfooting{\parsearg\everyfootingxxx}
  975. {\catcode`\@=0 %
  976. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  977. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  978. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  979. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  980. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  981. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  982. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  983. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  984. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  985. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  986. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  987. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  988. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  989. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  990. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  991. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  992. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  993. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  994. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  995. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  996. }% unbind the catcode of @.
  997. % @headings double    turns headings on for double-sided printing.
  998. % @headings single    turns headings on for single-sided printing.
  999. % @headings off        turns them off.
  1000. % @headings on        same as @headings double, retained for compatibility.
  1001. % @headings after    turns on double-sided headings after this page.
  1002. % @headings doubleafter    turns on double-sided headings after this page.
  1003. % @headings singleafter turns on single-sided headings after this page.
  1004. % By default, they are off.
  1005. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1006. \def\HEADINGSoff{
  1007. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1008. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1009. \HEADINGSoff
  1010. % When we turn headings on, set the page number to 1.
  1011. % For double-sided printing, put current file name in lower left corner,
  1012. % chapter name on inside top of right hand pages, document
  1013. % title on inside top of left hand pages, and page numbers on outside top
  1014. % edge of all pages.
  1015. \def\HEADINGSdouble{
  1016. %\pagealignmacro
  1017. \global\pageno=1
  1018. \global\evenfootline={\hfil}
  1019. \global\oddfootline={\hfil}
  1020. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1021. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1022. % For single-sided printing, chapter title goes across top left of page,
  1023. % page number on top right.
  1024. \def\HEADINGSsingle{
  1025. %\pagealignmacro
  1026. \global\pageno=1
  1027. \global\evenfootline={\hfil}
  1028. \global\oddfootline={\hfil}
  1029. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1030. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1031. \def\HEADINGSon{\HEADINGSdouble}
  1032. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1033. \let\HEADINGSdoubleafter=\HEADINGSafter
  1034. \def\HEADINGSdoublex{%
  1035. \global\evenfootline={\hfil}
  1036. \global\oddfootline={\hfil}
  1037. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1038. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1039. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1040. \def\HEADINGSsinglex{%
  1041. \global\evenfootline={\hfil}
  1042. \global\oddfootline={\hfil}
  1043. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1044. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1045. % Subroutines used in generating headings
  1046. % Produces Day Month Year style of output.
  1047. \def\today{\number\day\space
  1048. \ifcase\month\or
  1049. January\or February\or March\or April\or May\or June\or
  1050. July\or August\or September\or October\or November\or December\fi
  1051. \space\number\year}
  1052. % Use this if you want the Month Day, Year style of output.
  1053. %\def\today{\ifcase\month\or
  1054. %January\or February\or March\or April\or May\or June\or
  1055. %July\or August\or September\or October\or November\or December\fi
  1056. %\space\number\day, \number\year}
  1057. % @settitle line...  specifies the title of the document, for headings
  1058. % It generates no output of its own
  1059. \def\thistitle{No Title}
  1060. \def\settitle{\parsearg\settitlezzz}
  1061. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1062. \message{tables,}
  1063. % @tabs -- simple alignment
  1064. % These don't work.  For one thing, \+ is defined as outer.
  1065. % So these macros cannot even be defined.
  1066. %\def\tabs{\parsearg\tabszzz}
  1067. %\def\tabszzz #1{\settabs\+#1\cr}
  1068. %\def\tabline{\parsearg\tablinezzz}
  1069. %\def\tablinezzz #1{\+#1\cr}
  1070. %\def\&{&}
  1071. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1072. % default indentation of table text
  1073. \newdimen\tableindent \tableindent=.8in
  1074. % default indentation of @itemize and @enumerate text
  1075. \newdimen\itemindent  \itemindent=.3in
  1076. % margin between end of table item and start of table text.
  1077. \newdimen\itemmargin  \itemmargin=.1in
  1078. % used internally for \itemindent minus \itemmargin
  1079. \newdimen\itemmax
  1080. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1081. % these defs.
  1082. % They also define \itemindex
  1083. % to index the item name in whatever manner is desired (perhaps none).
  1084. \newif\ifitemxneedsnegativevskip
  1085. \def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi}
  1086. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1087. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1088. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1089. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1090. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1091. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1092. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1093.                  \itemzzz {#1}}
  1094. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1095.                  \itemzzz {#1}}
  1096. \def\itemzzz #1{\begingroup %
  1097.   \advance\hsize by -\rightskip
  1098.   \advance\hsize by -\tableindent
  1099.   \setbox0=\hbox{\itemfont{#1}}%
  1100.   \itemindex{#1}%
  1101.   \nobreak % This prevents a break before @itemx.
  1102.   % Be sure we are not still in the middle of a paragraph.
  1103.   %{\parskip = 0in
  1104.   %\par
  1105.   %}%
  1106.   % If the item text does not fit in the space we have, put it on a line
  1107.   % by itself, and do not allow a page break either before or after that
  1108.   % line.  We do not start a paragraph here because then if the next
  1109.   % command is, e.g., @kindex, the whatsit would get put into the
  1110.   % horizontal list on a line by itself, resulting in extra blank space.
  1111.   \ifdim \wd0>\itemmax
  1112.     %
  1113.     % Make this a paragraph so we get the \parskip glue and wrapping,
  1114.     % but leave it ragged-right.
  1115.     \begingroup
  1116.       \advance\leftskip by-\tableindent
  1117.       \advance\hsize by\tableindent
  1118.       \advance\rightskip by0pt plus1fil
  1119.       \leavevmode\unhbox0\par
  1120.     \endgroup
  1121.     %
  1122.     % We're going to be starting a paragraph, but we don't want the
  1123.     % \parskip glue -- logically it's part of the @item we just started.
  1124.     \nobreak \vskip-\parskip
  1125.     %
  1126.     % Stop a page break at the \parskip glue coming up.  Unfortunately
  1127.     % we can't prevent a possible page break at the following
  1128.     % \baselineskip glue.
  1129.     \nobreak
  1130.     \endgroup
  1131.     \itemxneedsnegativevskipfalse
  1132.   \else
  1133.     % The item text fits into the space.  Start a paragraph, so that the
  1134.     % following text (if any) will end up on the same line.  Since that
  1135.     % text will be indented by \tableindent, we make the item text be in
  1136.     % a zero-width box.
  1137.     \noindent
  1138.     \rlap{\hskip -\tableindent\box0}\ignorespaces%
  1139.     \endgroup%
  1140.     \itemxneedsnegativevskiptrue%
  1141.   \fi
  1142. \def\item{\errmessage{@item while not in a table}}
  1143. \def\itemx{\errmessage{@itemx while not in a table}}
  1144. \def\kitem{\errmessage{@kitem while not in a table}}
  1145. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1146. \def\xitem{\errmessage{@xitem while not in a table}}
  1147. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1148. %% Contains a kludge to get @end[description] to work
  1149. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1150. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1151. {\obeylines\obeyspaces%
  1152. \gdef\tablex #1^^M{%
  1153. \tabley\dontindex#1        \endtabley}}
  1154. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1155. {\obeylines\obeyspaces%
  1156. \gdef\ftablex #1^^M{%
  1157. \tabley\fnitemindex#1        \endtabley
  1158. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1159. \let\Etable=\relax}}
  1160. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1161. {\obeylines\obeyspaces%
  1162. \gdef\vtablex #1^^M{%
  1163. \tabley\vritemindex#1        \endtabley
  1164. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1165. \let\Etable=\relax}}
  1166. \def\dontindex #1{}
  1167. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1168. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1169. {\obeyspaces %
  1170. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1171. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1172. \def\tablez #1#2#3#4#5#6{%
  1173. \aboveenvbreak %
  1174. \begingroup %
  1175. \def\Edescription{\Etable}% Neccessary kludge.
  1176. \let\itemindex=#1%
  1177. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1178. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1179. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1180. \def\itemfont{#2}%
  1181. \itemmax=\tableindent %
  1182. \advance \itemmax by -\itemmargin %
  1183. \advance \leftskip by \tableindent %
  1184. \exdentamount=\tableindent
  1185. \parindent = 0pt
  1186. \parskip = \smallskipamount
  1187. \ifdim \parskip=0pt \parskip=2pt \fi%
  1188. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1189. \let\item = \internalBitem %
  1190. \let\itemx = \internalBitemx %
  1191. \let\kitem = \internalBkitem %
  1192. \let\kitemx = \internalBkitemx %
  1193. \let\xitem = \internalBxitem %
  1194. \let\xitemx = \internalBxitemx %
  1195. % This is the counter used by @enumerate, which is really @itemize
  1196. \newcount \itemno
  1197. \def\itemize{\parsearg\itemizezzz}
  1198. \def\itemizezzz #1{%
  1199.   \begingroup % ended by the @end itemsize
  1200.   \itemizey {#1}{\Eitemize}
  1201. \def\itemizey #1#2{%
  1202. \aboveenvbreak %
  1203. \itemmax=\itemindent %
  1204. \advance \itemmax by -\itemmargin %
  1205. \advance \leftskip by \itemindent %
  1206. \exdentamount=\itemindent
  1207. \parindent = 0pt %
  1208. \parskip = \smallskipamount %
  1209. \ifdim \parskip=0pt \parskip=2pt \fi%
  1210. \def#2{\endgraf\afterenvbreak\endgroup}%
  1211. \def\itemcontents{#1}%
  1212. \let\item=\itemizeitem}
  1213. % Set sfcode to normal for the chars that usually have another value.
  1214. % These are `.?!:;,'
  1215. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1216.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1217. % \splitoff TOKENS\endmark defines \first to be the first token in
  1218. % TOKENS, and \rest to be the remainder.
  1219. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1220. % Allow an optional argument of an uppercase letter, lowercase letter,
  1221. % or number, to specify the first label in the enumerated list.  No
  1222. % argument is the same as `1'.
  1223. \def\enumerate{\parsearg\enumeratezzz}
  1224. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1225. \def\enumeratey #1 #2\endenumeratey{%
  1226.   \begingroup % ended by the @end enumerate
  1227.   % If we were given no argument, pretend we were given `1'.
  1228.   \def\thearg{#1}%
  1229.   \ifx\thearg\empty \def\thearg{1}\fi
  1230.   % Detect if the argument is a single token.  If so, it might be a
  1231.   % letter.  Otherwise, the only valid thing it can be is a number.
  1232.   % (We will always have one token, because of the test we just made.
  1233.   % This is a good thing, since \splitoff doesn't work given nothing at
  1234.   % all -- the first parameter is undelimited.)
  1235.   \expandafter\splitoff\thearg\endmark
  1236.   \ifx\rest\empty
  1237.     % Only one token in the argument.  It could still be anything.
  1238.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1239.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1240.     %   not equal to itself.
  1241.     % Otherwise, we assume it's a number.
  1242.     %
  1243.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1244.     % continuing to look for a <number>.
  1245.     %
  1246.     \ifnum\lccode\expandafter`\thearg=0\relax
  1247.       \numericenumerate % a number (we hope)
  1248.     \else
  1249.       % It's a letter.
  1250.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1251.         \lowercaseenumerate % lowercase letter
  1252.       \else
  1253.         \uppercaseenumerate % uppercase letter
  1254.       \fi
  1255.     \fi
  1256.   \else
  1257.     % Multiple tokens in the argument.  We hope it's a number.
  1258.     \numericenumerate
  1259.   \fi
  1260. % An @enumerate whose labels are integers.  The starting integer is
  1261. % given in \thearg.
  1262. \def\numericenumerate{%
  1263.   \itemno = \thearg
  1264.   \startenumeration{\the\itemno}%
  1265. % The starting (lowercase) letter is in \thearg.
  1266. \def\lowercaseenumerate{%
  1267.   \itemno = \expandafter`\thearg
  1268.   \startenumeration{%
  1269.     % Be sure we're not beyond the end of the alphabet.
  1270.     \ifnum\itemno=0
  1271.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1272.                   alphabet}%
  1273.     \fi
  1274.     \char\lccode\itemno
  1275. % The starting (uppercase) letter is in \thearg.
  1276. \def\uppercaseenumerate{%
  1277.   \itemno = \expandafter`\thearg
  1278.   \startenumeration{%
  1279.     % Be sure we're not beyond the end of the alphabet.
  1280.     \ifnum\itemno=0
  1281.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1282.                   alphabet}
  1283.     \fi
  1284.     \char\uccode\itemno
  1285. % Call itemizey, adding a period to the first argument and supplying the
  1286. % common last two arguments.  Also subtract one from the initial value in
  1287. % \itemno, since @item increments \itemno.
  1288. \def\startenumeration#1{%
  1289.   \advance\itemno by -1
  1290.   \itemizey{#1.}\Eenumerate\flushcr
  1291. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1292. % to @enumerate.
  1293. \def\alphaenumerate{\enumerate{a}}
  1294. \def\capsenumerate{\enumerate{A}}
  1295. \def\Ealphaenumerate{\Eenumerate}
  1296. \def\Ecapsenumerate{\Eenumerate}
  1297. % Definition of @item while inside @itemize.
  1298. \def\itemizeitem{%
  1299. \advance\itemno by 1
  1300. {\let\par=\endgraf \smallbreak}%
  1301. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1302. {\parskip=0in \hskip 0pt
  1303. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1304. \vadjust{\penalty 1200}}%
  1305. \flushcr}
  1306. \message{indexing,}
  1307. % Index generation facilities
  1308. % Define \newwrite to be identical to plain tex's \newwrite
  1309. % except not \outer, so it can be used within \newindex.
  1310. {\catcode`\@=11
  1311. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1312. % \newindex {foo} defines an index named foo.
  1313. % It automatically defines \fooindex such that
  1314. % \fooindex ...rest of line... puts an entry in the index foo.
  1315. % It also defines \fooindfile to be the number of the output channel for
  1316. % the file that    accumulates this index.  The file's extension is foo.
  1317. % The name of an index should be no more than 2 characters long
  1318. % for the sake of vms.
  1319. \def\newindex #1{
  1320. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1321. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1322. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1323. \noexpand\doindex {#1}}
  1324. % @defindex foo  ==  \newindex{foo}
  1325. \def\defindex{\parsearg\newindex}
  1326. % Define @defcodeindex, like @defindex except put all entries in @code.
  1327. \def\newcodeindex #1{
  1328. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1329. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1330. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1331. \noexpand\docodeindex {#1}}
  1332. \def\defcodeindex{\parsearg\newcodeindex}
  1333. % @synindex foo bar    makes index foo feed into index bar.
  1334. % Do this instead of @defindex foo if you don't want it as a separate index.
  1335. \def\synindex #1 #2 {%
  1336. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1337. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1338. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1339. \noexpand\doindex {#2}}%
  1340. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1341. % inside @code.
  1342. \def\syncodeindex #1 #2 {%
  1343. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1344. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1345. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1346. \noexpand\docodeindex {#2}}%
  1347. % Define \doindex, the driver for all \fooindex macros.
  1348. % Argument #1 is generated by the calling \fooindex macro,
  1349. %  and it is "foo", the name of the index.
  1350. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1351. % This is because \doind is more useful to call from other macros.
  1352. % There is also \dosubind {index}{topic}{subtopic}
  1353. % which makes an entry in a two-level index such as the operation index.
  1354. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1355. \def\singleindexer #1{\doind{\indexname}{#1}}
  1356. % like the previous two, but they put @code around the argument.
  1357. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1358. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1359. \def\indexdummies{%
  1360. \def\_{{\realbackslash _}}%
  1361. \def\w{\realbackslash w }%
  1362. \def\bf{\realbackslash bf }%
  1363. \def\rm{\realbackslash rm }%
  1364. \def\sl{\realbackslash sl }%
  1365. \def\sf{\realbackslash sf}%
  1366. \def\tt{\realbackslash tt}%
  1367. \def\gtr{\realbackslash gtr}%
  1368. \def\less{\realbackslash less}%
  1369. \def\hat{\realbackslash hat}%
  1370. \def\char{\realbackslash char}%
  1371. \def\TeX{\realbackslash TeX}%
  1372. \def\dots{\realbackslash dots }%
  1373. \def\copyright{\realbackslash copyright }%
  1374. \def\tclose##1{\realbackslash tclose {##1}}%
  1375. \def\code##1{\realbackslash code {##1}}%
  1376. \def\samp##1{\realbackslash samp {##1}}%
  1377. \def\t##1{\realbackslash r {##1}}%
  1378. \def\r##1{\realbackslash r {##1}}%
  1379. \def\i##1{\realbackslash i {##1}}%
  1380. \def\b##1{\realbackslash b {##1}}%
  1381. \def\cite##1{\realbackslash cite {##1}}%
  1382. \def\key##1{\realbackslash key {##1}}%
  1383. \def\file##1{\realbackslash file {##1}}%
  1384. \def\var##1{\realbackslash var {##1}}%
  1385. \def\kbd##1{\realbackslash kbd {##1}}%
  1386. \def\dfn##1{\realbackslash dfn {##1}}%
  1387. \def\emph##1{\realbackslash emph {##1}}%
  1388. % \indexnofonts no-ops all font-change commands.
  1389. % This is used when outputting the strings to sort the index by.
  1390. \def\indexdummyfont#1{#1}
  1391. \def\indexdummytex{TeX}
  1392. \def\indexdummydots{...}
  1393. \def\indexnofonts{%
  1394. \let\w=\indexdummyfont
  1395. \let\t=\indexdummyfont
  1396. \let\r=\indexdummyfont
  1397. \let\i=\indexdummyfont
  1398. \let\b=\indexdummyfont
  1399. \let\emph=\indexdummyfont
  1400. \let\strong=\indexdummyfont
  1401. \let\cite=\indexdummyfont
  1402. \let\sc=\indexdummyfont
  1403. %Don't no-op \tt, since it isn't a user-level command
  1404. % and is used in the definitions of the active chars like <, >, |...
  1405. %\let\tt=\indexdummyfont
  1406. \let\tclose=\indexdummyfont
  1407. \let\code=\indexdummyfont
  1408. \let\file=\indexdummyfont
  1409. \let\samp=\indexdummyfont
  1410. \let\kbd=\indexdummyfont
  1411. \let\key=\indexdummyfont
  1412. \let\var=\indexdummyfont
  1413. \let\TeX=\indexdummytex
  1414. \let\dots=\indexdummydots
  1415. % To define \realbackslash, we must make \ not be an escape.
  1416. % We must first make another character (@) an escape
  1417. % so we do not become unable to do a definition.
  1418. {\catcode`\@=0 \catcode`\\=\other
  1419. @gdef@realbackslash{\}}
  1420. \let\indexbackslash=0  %overridden during \printindex.
  1421. \def\doind #1#2{%
  1422. {\count10=\lastpenalty %
  1423. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1424. \escapechar=`\\%
  1425. {\let\folio=0% Expand all macros now EXCEPT \folio
  1426. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1427. % so it will be output as is; and it will print as backslash in the indx.
  1428. % Now process the index-string once, with all font commands turned off,
  1429. % to get the string to sort the index by.
  1430. {\indexnofonts
  1431. \xdef\temp1{#2}%
  1432. % Now produce the complete index entry.  We process the index-string again,
  1433. % this time with font commands expanded, to get what to print in the index.
  1434. \edef\temp{%
  1435. \write \csname#1indfile\endcsname{%
  1436. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1437. \temp }%
  1438. }\penalty\count10}}
  1439. \def\dosubind #1#2#3{%
  1440. {\count10=\lastpenalty %
  1441. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1442. \escapechar=`\\%
  1443. {\let\folio=0%
  1444. \def\rawbackslashxx{\indexbackslash}%
  1445. % Now process the index-string once, with all font commands turned off,
  1446. % to get the string to sort the index by.
  1447. {\indexnofonts
  1448. \xdef\temp1{#2 #3}%
  1449. % Now produce the complete index entry.  We process the index-string again,
  1450. % this time with font commands expanded, to get what to print in the index.
  1451. \edef\temp{%
  1452. \write \csname#1indfile\endcsname{%
  1453. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1454. \temp }%
  1455. }\penalty\count10}}
  1456. % The index entry written in the file actually looks like
  1457. %  \entry {sortstring}{page}{topic}
  1458. %  \entry {sortstring}{page}{topic}{subtopic}
  1459. % The texindex program reads in these files and writes files
  1460. % containing these kinds of lines:
  1461. %  \initial {c}
  1462. %     before the first topic whose initial is c
  1463. %  \entry {topic}{pagelist}
  1464. %     for a topic that is used without subtopics
  1465. %  \primary {topic}
  1466. %     for the beginning of a topic that is used with subtopics
  1467. %  \secondary {subtopic}{pagelist}
  1468. %     for each subtopic.
  1469. % Define the user-accessible indexing commands
  1470. % @findex, @vindex, @kindex, @cindex.
  1471. \def\findex {\fnindex}
  1472. \def\kindex {\kyindex}
  1473. \def\cindex {\cpindex}
  1474. \def\vindex {\vrindex}
  1475. \def\tindex {\tpindex}
  1476. \def\pindex {\pgindex}
  1477. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1478. {\obeylines %
  1479. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1480. \dosubind{cp}{#2}{#1}}}
  1481. % Define the macros used in formatting output of the sorted index material.
  1482. % This is what you call to cause a particular index to get printed.
  1483. % Write
  1484. % @unnumbered Function Index
  1485. % @printindex fn
  1486. \def\printindex{\parsearg\doprintindex}
  1487. \def\doprintindex#1{%
  1488.   \tex
  1489.   \dobreak \chapheadingskip {10000}
  1490.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1491.   \catcode`\$=\other
  1492.   \catcode`\~=\other
  1493.   \indexbreaks
  1494.   % The following don't help, since the chars were translated
  1495.   % when the raw index was written, and their fonts were discarded
  1496.   % due to \indexnofonts.
  1497.   %\catcode`\"=\active
  1498.   %\catcode`\^=\active
  1499.   %\catcode`\_=\active
  1500.   %\catcode`\|=\active
  1501.   %\catcode`\<=\active
  1502.   %\catcode`\>=\active
  1503.   % %
  1504.   \def\indexbackslash{\rawbackslashxx}
  1505.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1506.   \begindoublecolumns
  1507.   % See if the index file exists and is nonempty.
  1508.   \openin 1 \jobname.#1s
  1509.   \ifeof 1
  1510.     % \enddoublecolumns gets confused if there is no text in the index,
  1511.     % and it loses the chapter title and the aux file entries for the
  1512.     % index.  The easiest way to prevent this problem is to make sure
  1513.     % there is some text.
  1514.     (Index is nonexistent)
  1515.     \else
  1516.     %
  1517.     % If the index file exists but is empty, then \openin leaves \ifeof
  1518.     % false.  We have to make TeX try to read something from the file, so
  1519.     % it can discover if there is anything in it.
  1520.     \read 1 to \temp
  1521.     \ifeof 1
  1522.       (Index is empty)
  1523.     \else
  1524.       \input \jobname.#1s
  1525.     \fi
  1526.   \fi
  1527.   \closein 1
  1528.   \enddoublecolumns
  1529.   \Etex
  1530. % These macros are used by the sorted index file itself.
  1531. % Change them to control the appearance of the index.
  1532. % Same as \bigskipamount except no shrink.
  1533. % \balancecolumns gets confused if there is any shrink.
  1534. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1535. \def\initial #1{%
  1536. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1537. \ifdim\lastskip<\initialskipamount
  1538. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1539. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1540. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  1541. % flush to the right margin.  It is used for index and table of contents
  1542. % entries.  The paragraph is indented by \leftskip.
  1543. \def\entry #1#2{\begingroup
  1544.   % Start a new paragraph if necessary, so our assignments below can't
  1545.   % affect previous text.
  1546.   \par
  1547.   % Do not fill out the last line with white space.
  1548.   \parfillskip = 0in
  1549.   % No extra space above this paragraph.
  1550.   \parskip = 0in
  1551.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  1552.   \finalhyphendemerits = 0
  1553.   % \hangindent is only relevant when the entry text and page number
  1554.   % don't both fit on one line.  In that case, bob suggests starting the
  1555.   % dots pretty far over on the line.  Unfortunately, a large
  1556.   % indentation looks wrong when the entry text itself is broken across
  1557.   % lines.  So we use a small indentation and put up with long leaders.
  1558.   % \hangafter is reset to 1 (which is the value we want) at the start
  1559.   % of each paragraph, so we need not do anything with that.
  1560.   \hangindent=2em
  1561.   % When the entry text needs to be broken, just fill out the first line
  1562.   % with blank space.
  1563.   \rightskip = 0pt plus1fil
  1564.   % Start a ``paragraph'' for the index entry so the line breaking
  1565.   % parameters we've set above will have an effect.
  1566.   \noindent
  1567.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  1568.   #1%
  1569.   % The following is kluged to not output a line of dots in the index if
  1570.   % there are no page numbers.  The next person who breaks this will be
  1571.   % cursed by a Unix daemon.
  1572.   \def\tempa{{\rm }}%
  1573.   \def\tempb{#2}%
  1574.   \edef\tempc{\tempa}%
  1575.   \edef\tempd{\tempb}%
  1576.   \ifx\tempc\tempd\ \else%
  1577.     %
  1578.     % If we must, put the page number on a line of its own, and fill out
  1579.     % this line with blank space.  (The \hfil is overwhelmed with the
  1580.     % fill leaders glue in \indexdotfill if the page number does fit.)
  1581.     \hfil\penalty50
  1582.     \null\nobreak\indexdotfill % Have leaders before the page number.
  1583.     %
  1584.     % The `\ ' here is removed by the implicit \unskip that TeX does as
  1585.     % part of (the primitive) \par.  Without it, a spurious underfull
  1586.     % \hbox ensues.
  1587.     \ #2% The page number ends the paragraph.
  1588.   \fi%
  1589.   \par
  1590. \endgroup}
  1591. % Like \dotfill except takes at least 1 em.
  1592. \def\indexdotfill{\cleaders
  1593.   \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1594. \def\primary #1{\line{#1\hfil}}
  1595. \newskip\secondaryindent \secondaryindent=0.5cm
  1596. \def\secondary #1#2{
  1597. {\parfillskip=0in \parskip=0in
  1598. \hangindent =1in \hangafter=1
  1599. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1600. %% Define two-column mode, which is used in indexes.
  1601. %% Adapted from the TeXbook, page 416.
  1602. \catcode `\@=11
  1603. \newbox\partialpage
  1604. \newdimen\doublecolumnhsize
  1605. \def\begindoublecolumns{\begingroup
  1606.   % Grab any single-column material above us.
  1607.   \output = {\global\setbox\partialpage
  1608.     =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
  1609.   \eject
  1610.   % Now switch to the double-column output routine.
  1611.   \output={\doublecolumnout}%
  1612.   % Change the page size parameters.  We could do this once outside this
  1613.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  1614.   % format, but then we repeat the same computation.  Repeating a couple
  1615.   % of assignments once per index is clearly meaningless for the
  1616.   % execution time, so we may as well do it once.
  1617.   % First we halve the line length, less a little for the gutter between
  1618.   % the columns.  We compute the gutter based on the line length, so it
  1619.   % changes automatically with the paper format.  The magic constant
  1620.   % below is chosen so that the gutter has the same value (well, +- <
  1621.   % 1pt) as it did when we hard-coded it.
  1622.   % We put the result in a separate register, \doublecolumhsize, so we
  1623.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  1624.   % been clobbered.
  1625.   \doublecolumnhsize = \hsize
  1626.     \advance\doublecolumnhsize by -.04154\hsize
  1627.     \divide\doublecolumnhsize by 2
  1628.   \hsize = \doublecolumnhsize
  1629.   % Double the \vsize as well.  (We don't need a separate register here,
  1630.   % since nobody clobbers \vsize.)
  1631.   \vsize = 2\vsize
  1632.   \doublecolumnpagegoal
  1633. \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
  1634. \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1635.   \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
  1636.   \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
  1637.   \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
  1638.   \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1639.   \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1640. \def\doublecolumnpagegoal{%
  1641.   \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
  1642. \def\pagesofar{\unvbox\partialpage %
  1643.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1644.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1645. \def\doublecolumnout{%
  1646.   \setbox5=\copy255
  1647.   {\vbadness=10000 \doublecolumnsplit}
  1648.   \ifvbox255
  1649.     \setbox0=\vtop to\dimen@{\unvbox0}
  1650.     \setbox2=\vtop to\dimen@{\unvbox2}
  1651.     \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
  1652.   \else
  1653.     \setbox0=\vbox{\unvbox5}
  1654.     \ifvbox0
  1655.       \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1656.       \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1657.       {\vbadness=10000
  1658.     \loop \global\setbox5=\copy0
  1659.           \setbox1=\vsplit5 to\dimen@
  1660.           \setbox3=\vsplit5 to\dimen@
  1661.           \ifvbox5 \global\advance\dimen@ by1pt \repeat
  1662.         \setbox0=\vbox to\dimen@{\unvbox1}
  1663.         \setbox2=\vbox to\dimen@{\unvbox3}
  1664.         \global\setbox\partialpage=\vbox{\pagesofar}
  1665.         \doublecolumnpagegoal
  1666.       }
  1667.     \fi
  1668.   \fi
  1669. \catcode `\@=\other
  1670. \message{sectioning,}
  1671. % Define chapters, sections, etc.
  1672. \newcount \chapno
  1673. \newcount \secno        \secno=0
  1674. \newcount \subsecno     \subsecno=0
  1675. \newcount \subsubsecno  \subsubsecno=0
  1676. % This counter is funny since it counts through charcodes of letters A, B, ...
  1677. \newcount \appendixno  \appendixno = `\@
  1678. \def\appendixletter{\char\the\appendixno}
  1679. \newwrite \contentsfile
  1680. % This is called from \setfilename.
  1681. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1682. % Each @chapter defines this as the name of the chapter.
  1683. % page headings and footings can use it.  @section does likewise
  1684. \def\thischapter{} \def\thissection{}
  1685. \def\seccheck#1{\if \pageno<0 %
  1686. \errmessage{@#1 not allowed after generating table of contents}\fi
  1687. \def\chapternofonts{%
  1688. \let\rawbackslash=\relax%
  1689. \let\frenchspacing=\relax%
  1690. \def\result{\realbackslash result}
  1691. \def\equiv{\realbackslash equiv}
  1692. \def\expansion{\realbackslash expansion}
  1693. \def\print{\realbackslash print}
  1694. \def\TeX{\realbackslash TeX}
  1695. \def\dots{\realbackslash dots}
  1696. \def\copyright{\realbackslash copyright}
  1697. \def\tt{\realbackslash tt}
  1698. \def\bf{\realbackslash bf }
  1699. \def\w{\realbackslash w}
  1700. \def\less{\realbackslash less}
  1701. \def\gtr{\realbackslash gtr}
  1702. \def\hat{\realbackslash hat}
  1703. \def\char{\realbackslash char}
  1704. \def\tclose##1{\realbackslash tclose {##1}}
  1705. \def\code##1{\realbackslash code {##1}}
  1706. \def\samp##1{\realbackslash samp {##1}}
  1707. \def\r##1{\realbackslash r {##1}}
  1708. \def\b##1{\realbackslash b {##1}}
  1709. \def\key##1{\realbackslash key {##1}}
  1710. \def\file##1{\realbackslash file {##1}}
  1711. \def\kbd##1{\realbackslash kbd {##1}}
  1712. % These are redefined because @smartitalic wouldn't work inside xdef.
  1713. \def\i##1{\realbackslash i {##1}}
  1714. \def\cite##1{\realbackslash cite {##1}}
  1715. \def\var##1{\realbackslash var {##1}}
  1716. \def\emph##1{\realbackslash emph {##1}}
  1717. \def\dfn##1{\realbackslash dfn {##1}}
  1718. \newcount\absseclevel % used to calculate proper heading level
  1719. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  1720. % @raisesections: treat @section as chapter, @subsection as section, etc.
  1721. \def\raisesections{\global\advance\secbase by -1}
  1722. \let\up=\raisesections % original BFox name
  1723. % @lowersections: treat @chapter as section, @section as subsection, etc.
  1724. \def\lowersections{\global\advance\secbase by 1}
  1725. \let\down=\lowersections % original BFox name
  1726. % Choose a numbered-heading macro
  1727. % #1 is heading level if unmodified by @raisesections or @lowersections
  1728. % #2 is text for heading
  1729. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1730. \ifcase\absseclevel
  1731.   \chapterzzz{#2}
  1732.   \seczzz{#2}
  1733.   \numberedsubseczzz{#2}
  1734.   \numberedsubsubseczzz{#2}
  1735. \else
  1736.   \ifnum \absseclevel<0
  1737.     \chapterzzz{#2}
  1738.   \else
  1739.     \numberedsubsubseczzz{#2}
  1740.   \fi
  1741. % like \numhead, but chooses appendix heading levels
  1742. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1743. \ifcase\absseclevel
  1744.   \appendixzzz{#2}
  1745.   \appendixsectionzzz{#2}
  1746.   \appendixsubseczzz{#2}
  1747.   \appendixsubsubseczzz{#2}
  1748. \else
  1749.   \ifnum \absseclevel<0
  1750.     \appendixzzz{#2}
  1751.   \else
  1752.     \appendixsubsubseczzz{#2}
  1753.   \fi
  1754. % like \numhead, but chooses numberless heading levels
  1755. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1756. \ifcase\absseclevel
  1757.   \unnumberedzzz{#2}
  1758.   \unnumberedseczzz{#2}
  1759.   \unnumberedsubseczzz{#2}
  1760.   \unnumberedsubsubseczzz{#2}
  1761. \else
  1762.   \ifnum \absseclevel<0
  1763.     \unnumberedzzz{#2}
  1764.   \else
  1765.     \unnumberedsubsubseczzz{#2}
  1766.   \fi
  1767. \def\thischaptername{No Chapter Title}
  1768. \outer\def\chapter{\parsearg\chapteryyy}
  1769. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  1770. \def\chapterzzz #1{\seccheck{chapter}%
  1771. \secno=0 \subsecno=0 \subsubsecno=0
  1772. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1773. \chapmacro {#1}{\the\chapno}%
  1774. \gdef\thissection{#1}%
  1775. \gdef\thischaptername{#1}%
  1776. % We don't substitute the actual chapter name into \thischapter
  1777. % because we don't want its macros evaluated now.
  1778. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1779. {\chapternofonts%
  1780. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1781. \escapechar=`\\%
  1782. \write \contentsfile \temp  %
  1783. \donoderef %
  1784. \global\let\section = \numberedsec
  1785. \global\let\subsection = \numberedsubsec
  1786. \global\let\subsubsection = \numberedsubsubsec
  1787. \outer\def\appendix{\parsearg\appendixyyy}
  1788. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  1789. \def\appendixzzz #1{\seccheck{appendix}%
  1790. \secno=0 \subsecno=0 \subsubsecno=0
  1791. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1792. \chapmacro {#1}{Appendix \appendixletter}%
  1793. \gdef\thissection{#1}%
  1794. \gdef\thischaptername{#1}%
  1795. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1796. {\chapternofonts%
  1797. \edef\temp{{\realbackslash chapentry
  1798.   {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1799. \escapechar=`\\%
  1800. \write \contentsfile \temp  %
  1801. \appendixnoderef %
  1802. \global\let\section = \appendixsec
  1803. \global\let\subsection = \appendixsubsec
  1804. \global\let\subsubsection = \appendixsubsubsec
  1805. \outer\def\top{\parsearg\unnumberedyyy}
  1806. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  1807. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  1808. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1809. \secno=0 \subsecno=0 \subsubsecno=0
  1810. % This used to be simply \message{#1}, but TeX fully expands the
  1811. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  1812. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  1813. % expanded @cite (which turns out to cause errors because \cite is meant
  1814. % to be executed, not expanded).
  1815. % Anyway, we don't want the fully-expanded definition of @cite to appear
  1816. % as a result of the \message, we just want `@cite' itself.  We use
  1817. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  1818. % simply yielding the contents of the <toks register>.
  1819. \toks0 = {#1}\message{(\the\toks0)}%
  1820. \unnumbchapmacro {#1}%
  1821. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1822. {\chapternofonts%
  1823. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1824. \escapechar=`\\%
  1825. \write \contentsfile \temp  %
  1826. \unnumbnoderef %
  1827. \global\let\section = \unnumberedsec
  1828. \global\let\subsection = \unnumberedsubsec
  1829. \global\let\subsubsection = \unnumberedsubsubsec
  1830. \outer\def\numberedsec{\parsearg\secyyy}
  1831. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  1832. \def\seczzz #1{\seccheck{section}%
  1833. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1834. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1835. {\chapternofonts%
  1836. \edef\temp{{\realbackslash secentry %
  1837. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1838. \escapechar=`\\%
  1839. \write \contentsfile \temp %
  1840. \donoderef %
  1841. \penalty 10000 %
  1842. \outer\def\appenixsection{\parsearg\appendixsecyyy}
  1843. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  1844. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  1845. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1846. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1847. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1848. {\chapternofonts%
  1849. \edef\temp{{\realbackslash secentry %
  1850. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1851. \escapechar=`\\%
  1852. \write \contentsfile \temp %
  1853. \appendixnoderef %
  1854. \penalty 10000 %
  1855. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  1856. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  1857. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1858. \plainsecheading {#1}\gdef\thissection{#1}%
  1859. {\chapternofonts%
  1860. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1861. \escapechar=`\\%
  1862. \write \contentsfile \temp %
  1863. \unnumbnoderef %
  1864. \penalty 10000 %
  1865. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  1866. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  1867. \def\numberedsubseczzz #1{\seccheck{subsection}%
  1868. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1869. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1870. {\chapternofonts%
  1871. \edef\temp{{\realbackslash subsecentry %
  1872. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1873. \escapechar=`\\%
  1874. \write \contentsfile \temp %
  1875. \donoderef %
  1876. \penalty 10000 %
  1877. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  1878. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  1879. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1880. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1881. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1882. {\chapternofonts%
  1883. \edef\temp{{\realbackslash subsecentry %
  1884. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1885. \escapechar=`\\%
  1886. \write \contentsfile \temp %
  1887. \appendixnoderef %
  1888. \penalty 10000 %
  1889. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  1890. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  1891. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1892. \plainsecheading {#1}\gdef\thissection{#1}%
  1893. {\chapternofonts%
  1894. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1895. \escapechar=`\\%
  1896. \write \contentsfile \temp %
  1897. \unnumbnoderef %
  1898. \penalty 10000 %
  1899. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  1900. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  1901. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  1902. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1903. \subsubsecheading {#1}
  1904.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1905. {\chapternofonts%
  1906. \edef\temp{{\realbackslash subsubsecentry %
  1907.   {#1}
  1908.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1909.   {\noexpand\folio}}}%
  1910. \escapechar=`\\%
  1911. \write \contentsfile \temp %
  1912. \donoderef %
  1913. \penalty 10000 %
  1914. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  1915. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  1916. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1917. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1918. \subsubsecheading {#1}
  1919.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1920. {\chapternofonts%
  1921. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1922.   {\appendixletter}
  1923.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1924. \escapechar=`\\%
  1925. \write \contentsfile \temp %
  1926. \appendixnoderef %
  1927. \penalty 10000 %
  1928. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  1929. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  1930. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1931. \plainsecheading {#1}\gdef\thissection{#1}%
  1932. {\chapternofonts%
  1933. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1934. \escapechar=`\\%
  1935. \write \contentsfile \temp %
  1936. \unnumbnoderef %
  1937. \penalty 10000 %
  1938. % These are variants which are not "outer", so they can appear in @ifinfo.
  1939. % Actually, they should now be obsolete; ordinary section commands should work.
  1940. \def\infotop{\parsearg\unnumberedzzz}
  1941. \def\infounnumbered{\parsearg\unnumberedzzz}
  1942. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1943. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1944. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1945. \def\infoappendix{\parsearg\appendixzzz}
  1946. \def\infoappendixsec{\parsearg\appendixseczzz}
  1947. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1948. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1949. \def\infochapter{\parsearg\chapterzzz}
  1950. \def\infosection{\parsearg\sectionzzz}
  1951. \def\infosubsection{\parsearg\subsectionzzz}
  1952. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1953. % These macros control what the section commands do, according
  1954. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  1955. % Define them by default for a numbered chapter.
  1956. \global\let\section = \numberedsec
  1957. \global\let\subsection = \numberedsubsec
  1958. \global\let\subsubsection = \numberedsubsubsec
  1959. % Define @majorheading, @heading and @subheading
  1960. % NOTE on use of \vbox for chapter headings, section headings, and
  1961. % such:
  1962. %    1) We use \vbox rather than the earlier \line to permit
  1963. %       overlong headings to fold.
  1964. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  1965. %       heading is obnoxious; this forbids it.
  1966. %       3) Likewise, headings look best if no \parindent is used, and
  1967. %          if justification is not attempted.  Hence \raggedright.
  1968. \def\majorheading{\parsearg\majorheadingzzz}
  1969. \def\majorheadingzzz #1{%
  1970. {\advance\chapheadingskip by 10pt \chapbreak }%
  1971. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1972.                   \parindent=0pt\raggedright
  1973.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1974. \def\chapheading{\parsearg\chapheadingzzz}
  1975. \def\chapheadingzzz #1{\chapbreak %
  1976. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1977.                   \parindent=0pt\raggedright
  1978.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1979. \def\heading{\parsearg\secheadingi}
  1980. \def\subheading{\parsearg\subsecheadingi}
  1981. \def\subsubheading{\parsearg\subsubsecheadingi}
  1982. % These macros generate a chapter, section, etc. heading only
  1983. % (including whitespace, linebreaking, etc. around it),
  1984. % given all the information in convenient, parsed form.
  1985. %%% Args are the skip and penalty (usually negative)
  1986. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1987. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1988. %%% Define plain chapter starts, and page on/off switching for it
  1989. % Parameter controlling skip before chapter headings (if needed)
  1990. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1991. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1992. \def\chappager{\par\vfill\supereject}
  1993. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1994. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1995. \def\CHAPPAGoff{
  1996. \global\let\pchapsepmacro=\chapbreak
  1997. \global\let\pagealignmacro=\chappager}
  1998. \def\CHAPPAGon{
  1999. \global\let\pchapsepmacro=\chappager
  2000. \global\let\pagealignmacro=\chappager
  2001. \global\def\HEADINGSon{\HEADINGSsingle}}
  2002. \def\CHAPPAGodd{
  2003. \global\let\pchapsepmacro=\chapoddpage
  2004. \global\let\pagealignmacro=\chapoddpage
  2005. \global\def\HEADINGSon{\HEADINGSdouble}}
  2006. \CHAPPAGon
  2007. \def\CHAPFplain{
  2008. \global\let\chapmacro=\chfplain
  2009. \global\let\unnumbchapmacro=\unnchfplain}
  2010. \def\chfplain #1#2{%
  2011.   \pchapsepmacro
  2012.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2013.                      \parindent=0pt\raggedright
  2014.                      \rm #2\enspace #1}%
  2015.   \bigskip
  2016.   \penalty5000
  2017. \def\unnchfplain #1{%
  2018. \pchapsepmacro %
  2019. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2020.                   \parindent=0pt\raggedright
  2021.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2022. \CHAPFplain % The default
  2023. \def\unnchfopen #1{%
  2024. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2025.                        \parindent=0pt\raggedright
  2026.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2027. \def\chfopen #1#2{\chapoddpage {\chapfonts
  2028. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  2029. \par\penalty 5000 %
  2030. \def\CHAPFopen{
  2031. \global\let\chapmacro=\chfopen
  2032. \global\let\unnumbchapmacro=\unnchfopen}
  2033. % Parameter controlling skip before section headings.
  2034. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  2035. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  2036. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  2037. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  2038. % @paragraphindent  is defined for the Info formatting commands only.
  2039. \let\paragraphindent=\comment
  2040. % Section fonts are the base font at magstep2, which produces
  2041. % a size a bit more than 14 points in the default situation.
  2042. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  2043. \def\plainsecheading #1{\secheadingi {#1}}
  2044. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  2045. \secheadingbreak}%
  2046. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2047.                  \parindent=0pt\raggedright
  2048.                  \rm #1\hfill}}%
  2049. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2050. % Subsection fonts are the base font at magstep1,
  2051. % which produces a size of 12 points.
  2052. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  2053. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2054. \subsecheadingbreak}%
  2055. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2056.                      \parindent=0pt\raggedright
  2057.                      \rm #1\hfill}}%
  2058. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2059. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  2060.                   % Perhaps make sssec fonts scaled
  2061.                   % magstep half
  2062. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  2063. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2064. \subsecheadingbreak}%
  2065. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2066.                        \parindent=0pt\raggedright
  2067.                        \rm #1\hfill}}%
  2068. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  2069. \message{toc printing,}
  2070. % Finish up the main text and prepare to read what we've written
  2071. % to \contentsfile.
  2072. \newskip\contentsrightmargin \contentsrightmargin=1in
  2073. \def\startcontents#1{%
  2074.    \pagealignmacro
  2075.    \immediate\closeout \contentsfile
  2076.    \ifnum \pageno>0
  2077.       \pageno = -1        % Request roman numbered pages.
  2078.    \fi
  2079.    % Don't need to put `Contents' or `Short Contents' in the headline.
  2080.    % It is abundantly clear what they are.
  2081.    \unnumbchapmacro{#1}\def\thischapter{}%
  2082.    \begingroup           % Set up to handle contents files properly.
  2083.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2084.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2085.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2086. % Normal (long) toc.
  2087. \outer\def\contents{%
  2088.    \startcontents{Table of Contents}%
  2089.       \input \jobname.toc
  2090.    \endgroup
  2091.    \vfill \eject
  2092. % And just the chapters.
  2093. \outer\def\summarycontents{%
  2094.    \startcontents{Short Contents}%
  2095.       %
  2096.       \let\chapentry = \shortchapentry
  2097.       \let\unnumbchapentry = \shortunnumberedentry
  2098.       % We want a true roman here for the page numbers.
  2099.       \secfonts
  2100.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2101.       \rm
  2102.       \advance\baselineskip by 1pt % Open it up a little.
  2103.       \def\secentry ##1##2##3##4{}
  2104.       \def\unnumbsecentry ##1##2{}
  2105.       \def\subsecentry ##1##2##3##4##5{}
  2106.       \def\unnumbsubsecentry ##1##2{}
  2107.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2108.       \def\unnumbsubsubsecentry ##1##2{}
  2109.       \input \jobname.toc
  2110.    \endgroup
  2111.    \vfill \eject
  2112. \let\shortcontents = \summarycontents
  2113. % These macros generate individual entries in the table of contents.
  2114. % The first argument is the chapter or section name.
  2115. % The last argument is the page number.
  2116. % The arguments in between are the chapter number, section number, ...
  2117. % Chapter-level things, for both the long and short contents.
  2118. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2119. % See comments in \dochapentry re vbox and related settings
  2120. \def\shortchapentry#1#2#3{%
  2121.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2122. % Typeset the label for a chapter or appendix for the short contents.
  2123. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2124. % We could simplify the code here by writing out an \appendixentry
  2125. % command in the toc file for appendices, instead of using \chapentry
  2126. % for both, but it doesn't seem worth it.
  2127. \setbox0 = \hbox{\shortcontrm Appendix }
  2128. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2129. \def\shortchaplabel#1{%
  2130.   % We typeset #1 in a box of constant width, regardless of the text of
  2131.   % #1, so the chapter titles will come out aligned.
  2132.   \setbox0 = \hbox{#1}%
  2133.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2134.   % This space should be plenty, since a single number is .5em, and the
  2135.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2136.   % (This space doesn't include the extra space that gets added after
  2137.   % the label; that gets put in in \shortchapentry above.)
  2138.   \advance\dimen0 by 1.1em
  2139.   \hbox to \dimen0{#1\hfil}%
  2140. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2141. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2142. % Sections.
  2143. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2144. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2145. % Subsections.
  2146. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2147. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2148. % And subsubsections.
  2149. \def\subsubsecentry#1#2#3#4#5#6{%
  2150.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2151. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2152. % This parameter controls the indentation of the various levels.
  2153. \newdimen\tocindent \tocindent = 3pc
  2154. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  2155. % page number.
  2156. % If the toc has to be broken over pages, we would want to be at chapters
  2157. % if at all possible; hence the \penalty.
  2158. \def\dochapentry#1#2{%
  2159.    \penalty-300 \vskip\baselineskip
  2160.    \begingroup
  2161.      \chapentryfonts
  2162.      \tocentry{#1}{\dopageno{#2}}%
  2163.    \endgroup
  2164.    \nobreak\vskip .25\baselineskip
  2165. \def\dosecentry#1#2{\begingroup
  2166.   \secentryfonts \leftskip=\tocindent
  2167.   \tocentry{#1}{\dopageno{#2}}%
  2168. \endgroup}
  2169. \def\dosubsecentry#1#2{\begingroup
  2170.   \subsecentryfonts \leftskip=2\tocindent
  2171.   \tocentry{#1}{\dopageno{#2}}%
  2172. \endgroup}
  2173. \def\dosubsubsecentry#1#2{\begingroup
  2174.   \subsubsecentryfonts \leftskip=3\tocindent
  2175.   \tocentry{#1}{\dopageno{#2}}%
  2176. \endgroup}
  2177. % Final typesetting of a toc entry; we use the same \entry macro as for
  2178. % the index entries, but we want to suppress hyphenation here.  (We
  2179. % can't do that in the \entry macro, since index entries might consist
  2180. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2181. \def\tocentry#1#2{\begingroup
  2182.   \hyphenpenalty = 10000
  2183.   \entry{#1}{#2}%
  2184. \endgroup}
  2185. % Space between chapter (or whatever) number and the title.
  2186. \def\labelspace{\hskip1em \relax}
  2187. \def\dopageno#1{{\rm #1}}
  2188. \def\doshortpageno#1{{\rm #1}}
  2189. \def\chapentryfonts{\secfonts \rm}
  2190. \def\secentryfonts{\textfonts}
  2191. \let\subsecentryfonts = \textfonts
  2192. \let\subsubsecentryfonts = \textfonts
  2193. \message{environments,}
  2194. % Since these characters are used in examples, it should be an even number of
  2195. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2196. % Furthermore, these definitions must come after we define our fonts.
  2197. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2198. \newbox\pushcharbox    \newbox\bullbox
  2199. \newbox\equivbox       \newbox\errorbox
  2200. \let\ptexequiv = \equiv
  2201. %{\tentt
  2202. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2203. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2204. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2205. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2206. % Adapted from the manmac format (p.420 of TeXbook)
  2207. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2208. %                                      depth .1ex\hfil}
  2209. \def\point{$\star$}
  2210. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2211. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2212. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2213. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2214. % Adapted from the TeXbook's \boxit.
  2215. {\tentt \global\dimen0 = 3em}% Width of the box.
  2216. \dimen2 = .55pt % Thickness of rules
  2217. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2218. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2219. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2220.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2221.    \advance\hsize by -2\dimen2 % Rules.
  2222.    \vbox{
  2223.       \hrule height\dimen2
  2224.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2225.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2226.          \kern3pt\vrule width\dimen2}% Space to right.
  2227.       \hrule height\dimen2}
  2228.     \hfil}
  2229. % The @error{} command.
  2230. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2231. % @tex ... @end tex    escapes into raw Tex temporarily.
  2232. % One exception: @ is still an escape character, so that @end tex works.
  2233. % But \@ or @@ will get a plain tex @ character.
  2234. \def\tex{\begingroup
  2235. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2236. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2237. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2238. \catcode `\%=14
  2239. \catcode 43=12
  2240. \catcode`\"=12
  2241. \catcode`\==12
  2242. \catcode`\|=12
  2243. \catcode`\<=12
  2244. \catcode`\>=12
  2245. \escapechar=`\\
  2246. \let\{=\ptexlbrace
  2247. \let\}=\ptexrbrace
  2248. \let\.=\ptexdot
  2249. \let\*=\ptexstar
  2250. \let\dots=\ptexdots
  2251. \def\@{@}%
  2252. \let\bullet=\ptexbullet
  2253. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2254. \let\L=\ptexL
  2255. \let\Etex=\endgroup}
  2256. % Define @lisp ... @endlisp.
  2257. % @lisp does a \begingroup so it can rebind things,
  2258. % including the definition of @endlisp (which normally is erroneous).
  2259. % Amount to narrow the margins by for @lisp.
  2260. \newskip\lispnarrowing \lispnarrowing=0.4in
  2261. % This is the definition that ^^M gets inside @lisp, @example, and other
  2262. % such environments.  \null is better than a space, since it doesn't
  2263. % have any width.
  2264. \def\lisppar{\null\endgraf}
  2265. % Make each space character in the input produce a normal interword
  2266. % space in the output.  Don't allow a line break at this space, as this
  2267. % is used only in environments like @example, where each line of input
  2268. % should produce a line of output anyway.
  2269. {\obeyspaces %
  2270. \gdef\sepspaces{\obeyspaces\let =\tie}}
  2271. % Define \obeyedspace to be our active space, whatever it is.  This is
  2272. % for use in \parsearg.
  2273. {\sepspaces %
  2274. \global\let\obeyedspace= }
  2275. % This space is always present above and below environments.
  2276. \newskip\envskipamount \envskipamount = 0pt
  2277. % Make spacing and below environment symmetrical.  We use \parskip here
  2278. % to help in doing that, since in @example-like environments \parskip
  2279. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  2280. % start of the next paragraph will insert \parskip
  2281. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  2282. \endgraf \ifdim\lastskip<\envskipamount
  2283. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  2284. \let\afterenvbreak = \aboveenvbreak
  2285. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2286. \let\nonarrowing=\relax
  2287. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2288. % \cartouche: draw rectangle w/rounded corners around argument
  2289. \font\circle=lcircle10
  2290. \newdimen\circthick
  2291. \newdimen\cartouter\newdimen\cartinner
  2292. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2293. \circthick=\fontdimen8\circle
  2294. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2295. \def\ctr{{\hskip 6pt\circle\char'010}}
  2296. \def\cbl{{\circle\char'012\hskip -6pt}}
  2297. \def\cbr{{\hskip 6pt\circle\char'011}}
  2298. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2299.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2300.     \hskip\rskip}}
  2301. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2302.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2303.     \hskip\rskip}}
  2304. \newskip\lskip\newskip\rskip
  2305. \long\def\cartouche{%
  2306. \begingroup
  2307.     \lskip=\leftskip \rskip=\rightskip
  2308.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2309.     \cartinner=\hsize \advance\cartinner by-\lskip
  2310.                \advance\cartinner by-\rskip
  2311.     \cartouter=\hsize
  2312.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2313. %                     side, and for 6pt waste from
  2314. %                     each corner char
  2315.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2316.     % Flag to tell @lisp, etc., not to narrow margin.
  2317.     \let\nonarrowing=\comment
  2318.     \vbox\bgroup
  2319.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2320.         \carttop
  2321.         \hbox\bgroup
  2322.             \hskip\lskip
  2323.             \vrule\kern3pt
  2324.             \vbox\bgroup
  2325.                 \hsize=\cartinner
  2326.                 \kern3pt
  2327.                 \begingroup
  2328.                     \baselineskip=\normbskip
  2329.                     \lineskip=\normlskip
  2330.                     \parskip=\normpskip
  2331.                     \vskip -\parskip
  2332. \def\Ecartouche{%
  2333.                 \endgroup
  2334.                 \kern3pt
  2335.             \egroup
  2336.             \kern3pt\vrule
  2337.             \hskip\rskip
  2338.         \egroup
  2339.         \cartbot
  2340.     \egroup
  2341. \endgroup
  2342. % This macro is called at the beginning of all the @example variants,
  2343. % inside a group.
  2344. \def\nonfillstart{%
  2345.   \aboveenvbreak
  2346.   \inENV % This group ends at the end of the body
  2347.   \hfuzz = 12pt % Don't be fussy
  2348.   \sepspaces % Make spaces be word-separators rather than space tokens.
  2349.   \singlespace
  2350.   \let\par = \lisppar % don't ignore blank lines
  2351.   \obeylines % each line of input is a line of output
  2352.   \parskip = 0pt
  2353.   \parindent = 0pt
  2354.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  2355.   % @cartouche defines \nonarrowing to inhibit narrowing
  2356.   % at next level down.
  2357.   \ifx\nonarrowing\relax
  2358.     \advance \leftskip by \lispnarrowing
  2359.     \exdentamount=\lispnarrowing
  2360.     \let\exdent=\nofillexdent
  2361.     \let\nonarrowing=\relax
  2362.   \fi
  2363. % To ending an @example-like environment, we first end the paragraph
  2364. % (via \afterenvbreak's vertical glue), and then the group.  That way we
  2365. % keep the zero \parskip that the environments set -- \parskip glue
  2366. % will be inserted at the beginning of the next paragraph in the
  2367. % document, after the environment.
  2368. \def\nonfillfinish{\afterenvbreak\endgroup}%
  2369. % This macro is
  2370. \def\lisp{\begingroup
  2371.   \nonfillstart
  2372.   \let\Elisp = \nonfillfinish
  2373.   \tt
  2374.   \rawbackslash % have \ input char produce \ char from current font
  2375.   \gobble
  2376. % Define the \E... control sequence only if we are inside the
  2377. % environment, so the error checking in \end will work.
  2378. % We must call \lisp last in the definition, since it reads the
  2379. % return following the @example (or whatever) command.
  2380. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  2381. \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
  2382. \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
  2383. % @smallexample and @smalllisp.  This is not used unless the @smallbook
  2384. % command is given.  Originally contributed by Pavel@xerox.
  2385. \def\smalllispx{\begingroup
  2386.   \nonfillstart
  2387.   \let\Esmalllisp = \nonfillfinish
  2388.   \let\Esmallexample = \nonfillfinish
  2389.   % Smaller interline space and fonts for small examples.
  2390.   \baselineskip 10pt
  2391.   \indexfonts \tt
  2392.   \rawbackslash % output the \ character from the current font
  2393.   \gobble
  2394. % This is @display; same as @lisp except use roman font.
  2395. \def\display{\begingroup
  2396.   \nonfillstart
  2397.   \let\Edisplay = \nonfillfinish
  2398.   \gobble
  2399. % This is @format; same as @display except don't narrow margins.
  2400. \def\format{\begingroup
  2401.   \let\nonarrowing = t
  2402.   \nonfillstart
  2403.   \let\Eformat = \nonfillfinish
  2404.   \gobble
  2405. % @flushleft (same as @format) and @flushright.
  2406. \def\flushleft{\begingroup
  2407.   \let\nonarrowing = t
  2408.   \nonfillstart
  2409.   \let\Eflushleft = \nonfillfinish
  2410.   \gobble
  2411. \def\flushright{\begingroup
  2412.   \let\nonarrowing = t
  2413.   \nonfillstart
  2414.   \let\Eflushright = \nonfillfinish
  2415.   \advance\leftskip by 0pt plus 1fill
  2416.   \gobble}
  2417. % @quotation does normal linebreaking and narrows the margins.
  2418. \def\quotation{%
  2419. \begingroup\inENV %This group ends at the end of the @quotation body
  2420. {\parskip=0pt  % because we will skip by \parskip too, later
  2421. \aboveenvbreak}%
  2422. \singlespace
  2423. \parindent=0pt
  2424. \let\Equotation = \nonfillfinish
  2425. % @cartouche defines \nonarrowing to inhibit narrowing
  2426. % at next level down.
  2427. \ifx\nonarrowing\relax
  2428. \advance \leftskip by \lispnarrowing
  2429. \advance \rightskip by \lispnarrowing
  2430. \exdentamount=\lispnarrowing
  2431. \let\nonarrowing=\relax
  2432. \message{defuns,}
  2433. % Define formatter for defuns
  2434. % First, allow user to change definition object font (\df) internally
  2435. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2436. \newskip\defbodyindent \defbodyindent=.4in
  2437. \newskip\defargsindent \defargsindent=50pt
  2438. \newskip\deftypemargin \deftypemargin=12pt
  2439. \newskip\deflastargmargin \deflastargmargin=18pt
  2440. \newcount\parencount
  2441. % define \functionparens, which makes ( and ) and & do special things.
  2442. % \functionparens affects the group it is contained in.
  2443. \def\activeparens{%
  2444. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2445. \catcode`\[=\active \catcode`\]=\active}
  2446. % Make control sequences which act like normal parenthesis chars.
  2447. \let\lparen = ( \let\rparen = )
  2448. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2449. % Be sure that we always have a definition for `(', etc.  For example,
  2450. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  2451. % so TeX would otherwise complain about undefined control sequence.
  2452. \global\let(=\lparen \global\let)=\rparen
  2453. \global\let[=\lbrack \global\let]=\rbrack
  2454. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2455. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2456. % Definitions of (, ) and & used in args for functions.
  2457. % This is the definition of ( outside of all parentheses.
  2458. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2459. \global\advance\parencount by 1 }
  2460. % This is the definition of ( when already inside a level of parens.
  2461. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2462. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2463. % also in that case restore the outer-level definition of (.
  2464. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2465. \global\advance \parencount by -1 }
  2466. % If we encounter &foo, then turn on ()-hacking afterwards
  2467. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2468. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2469. } % End of definition inside \activeparens
  2470. %% These parens (in \boldbrax) actually are a little bolder than the
  2471. %% contained text.  This is especially needed for [ and ]
  2472. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2473. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2474. % First, defname, which formats the header line itself.
  2475. % #1 should be the function name.
  2476. % #2 should be the type of definition, such as "Function".
  2477. \def\defname #1#2{%
  2478. % Get the values of \leftskip and \rightskip as they were
  2479. % outside the @def...
  2480. \dimen2=\leftskip
  2481. \advance\dimen2 by -\defbodyindent
  2482. \dimen3=\rightskip
  2483. \advance\dimen3 by -\defbodyindent
  2484. \noindent        %
  2485. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2486. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2487. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2488. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2489. % Now output arg 2 ("Function" or some such)
  2490. % ending at \deftypemargin from the right margin,
  2491. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2492. {% Adjust \hsize to exclude the ambient margins,
  2493. % so that \rightline will obey them.
  2494. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2495. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2496. % Make all lines underfull and no complaints:
  2497. \tolerance=10000 \hbadness=10000
  2498. \advance\leftskip by -\defbodyindent
  2499. \exdentamount=\defbodyindent
  2500. {\df #1}\enskip        % Generate function name
  2501. % Actually process the body of a definition
  2502. % #1 should be the terminating control sequence, such as \Edefun.
  2503. % #2 should be the "another name" control sequence, such as \defunx.
  2504. % #3 should be the control sequence that actually processes the header,
  2505. %    such as \defunheader.
  2506. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2507. \medbreak %
  2508. % Define the end token that this defining construct specifies
  2509. % so that it will exit this group.
  2510. \def#1{\endgraf\endgroup\medbreak}%
  2511. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2512. \parindent=0in
  2513. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2514. \exdentamount=\defbodyindent
  2515. \begingroup %
  2516. \catcode 61=\active % 61 is `='
  2517. \obeylines\activeparens\spacesplit#3}
  2518. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2519. \medbreak %
  2520. % Define the end token that this defining construct specifies
  2521. % so that it will exit this group.
  2522. \def#1{\endgraf\endgroup\medbreak}%
  2523. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2524. \parindent=0in
  2525. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2526. \exdentamount=\defbodyindent
  2527. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2528. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2529. \medbreak %
  2530. % Define the end token that this defining construct specifies
  2531. % so that it will exit this group.
  2532. \def#1{\endgraf\endgroup\medbreak}%
  2533. \def#2##1 ##2 {\def#4{##1}%
  2534. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2535. \parindent=0in
  2536. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2537. \exdentamount=\defbodyindent
  2538. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2539. % These parsing functions are similar to the preceding ones
  2540. % except that they do not make parens into active characters.
  2541. % These are used for "variables" since they have no arguments.
  2542. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2543. \medbreak %
  2544. % Define the end token that this defining construct specifies
  2545. % so that it will exit this group.
  2546. \def#1{\endgraf\endgroup\medbreak}%
  2547. \def#2{\begingroup\obeylines\spacesplit#3}%
  2548. \parindent=0in
  2549. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2550. \exdentamount=\defbodyindent
  2551. \begingroup %
  2552. \catcode 61=\active %
  2553. \obeylines\spacesplit#3}
  2554. % This is used for \def{tp,vr}parsebody.  It could probably be used for
  2555. % some of the others, too, with some judicious conditionals.
  2556. \def\parsebodycommon#1#2#3{%
  2557.   \begingroup\inENV %
  2558.   \medbreak %
  2559.   % Define the end token that this defining construct specifies
  2560.   % so that it will exit this group.
  2561.   \def#1{\endgraf\endgroup\medbreak}%
  2562.   \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2563.   \parindent=0in
  2564.   \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2565.   \exdentamount=\defbodyindent
  2566.   \begingroup\obeylines
  2567. \def\defvrparsebody#1#2#3#4 {%
  2568.   \parsebodycommon{#1}{#2}{#3}%
  2569.   \spacesplit{#3{#4}}%
  2570. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  2571. % type is just `struct', because we lose the braces in `{struct
  2572. % termios}' when \spacesplit reads its undelimited argument.  Sigh.
  2573. % \let\deftpparsebody=\defvrparsebody
  2574. % So, to get around this, we put \empty in with the type name.  That
  2575. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  2576. % won't strip off the braces.
  2577. \def\deftpparsebody #1#2#3#4 {%
  2578.   \parsebodycommon{#1}{#2}{#3}%
  2579.   \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  2580. % Fine, but then we have to eventually remove the \empty *and* the
  2581. % braces (if any).  That's what this does, putting the result in \tptemp.
  2582. \def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
  2583. % After \spacesplit has done its work, this is called -- #1 is the final
  2584. % thing to call, #2 the type name (which starts with \empty), and #3
  2585. % (which might be empty) the arguments.
  2586. \def\parsetpheaderline#1#2#3{%
  2587.   \removeemptybraces#2\relax
  2588.   #1{\tptemp}{#3}%
  2589. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2590. \medbreak %
  2591. % Define the end token that this defining construct specifies
  2592. % so that it will exit this group.
  2593. \def#1{\endgraf\endgroup\medbreak}%
  2594. \def#2##1 ##2 {\def#4{##1}%
  2595. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2596. \parindent=0in
  2597. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2598. \exdentamount=\defbodyindent
  2599. \begingroup\obeylines\spacesplit{#3{#5}}}
  2600. % Split up #2 at the first space token.
  2601. % call #1 with two arguments:
  2602. %  the first is all of #2 before the space token,
  2603. %  the second is all of #2 after that space token.
  2604. % If #2 contains no space token, all of it is passed as the first arg
  2605. % and the second is passed as empty.
  2606. {\obeylines
  2607. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2608. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2609. \ifx\relax #3%
  2610. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2611. % So much for the things common to all kinds of definitions.
  2612. % Define @defun.
  2613. % First, define the processing that is wanted for arguments of \defun
  2614. % Use this to expand the args and terminate the paragraph they make up
  2615. \def\defunargs #1{\functionparens \sl
  2616. % Expand, preventing hyphenation at `-' chars.
  2617. % Note that groups don't affect changes in \hyphenchar.
  2618. \hyphenchar\tensl=0
  2619. \hyphenchar\tensl=45
  2620. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2621. \interlinepenalty=10000
  2622. \advance\rightskip by 0pt plus 1fil
  2623. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2624. \def\deftypefunargs #1{%
  2625. % Expand, preventing hyphenation at `-' chars.
  2626. % Note that groups don't affect changes in \hyphenchar.
  2627. \functionparens
  2628. \code{#1}%
  2629. \interlinepenalty=10000
  2630. \advance\rightskip by 0pt plus 1fil
  2631. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2632. % Do complete processing of one @defun or @defunx line already parsed.
  2633. % @deffn Command forward-char nchars
  2634. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2635. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2636. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2637. \catcode 61=\other % Turn off change made in \defparsebody
  2638. % @defun == @deffn Function
  2639. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2640. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2641. \begingroup\defname {#1}{Function}%
  2642. \defunargs {#2}\endgroup %
  2643. \catcode 61=\other % Turn off change made in \defparsebody
  2644. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2645. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2646. % #1 is the data type.  #2 is the name and args.
  2647. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2648. % #1 is the data type, #2 the name, #3 the args.
  2649. \def\deftypefunheaderx #1#2 #3\relax{%
  2650. \doind {fn}{\code{#2}}% Make entry in function index
  2651. \begingroup\defname {\code{#1} #2}{Function}%
  2652. \deftypefunargs {#3}\endgroup %
  2653. \catcode 61=\other % Turn off change made in \defparsebody
  2654. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2655. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2656. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2657. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2658. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2659. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2660. \doind {fn}{\code{#3}}% Make entry in function index
  2661. \begingroup
  2662. \normalparens % notably, turn off `&' magic, which prevents
  2663. %               at least some C++ text from working
  2664. \defname {\code{#2} #3}{#1}%
  2665. \deftypefunargs {#4}\endgroup %
  2666. \catcode 61=\other % Turn off change made in \defparsebody
  2667. % @defmac == @deffn Macro
  2668. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2669. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2670. \begingroup\defname {#1}{Macro}%
  2671. \defunargs {#2}\endgroup %
  2672. \catcode 61=\other % Turn off change made in \defparsebody
  2673. % @defspec == @deffn Special Form
  2674. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2675. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2676. \begingroup\defname {#1}{Special Form}%
  2677. \defunargs {#2}\endgroup %
  2678. \catcode 61=\other % Turn off change made in \defparsebody
  2679. % This definition is run if you use @defunx
  2680. % anywhere other than immediately after a @defun or @defunx.
  2681. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2682. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2683. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2684. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2685. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2686. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2687. % @defmethod, and so on
  2688. % @defop {Funny Method} foo-class frobnicate argument
  2689. \def\defop #1 {\def\defoptype{#1}%
  2690. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2691. \def\defopheader #1#2#3{%
  2692. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2693. \begingroup\defname {#2}{\defoptype{} on #1}%
  2694. \defunargs {#3}\endgroup %
  2695. % @defmethod == @defop Method
  2696. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2697. \def\defmethodheader #1#2#3{%
  2698. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2699. \begingroup\defname {#2}{Method on #1}%
  2700. \defunargs {#3}\endgroup %
  2701. % @defcv {Class Option} foo-class foo-flag
  2702. \def\defcv #1 {\def\defcvtype{#1}%
  2703. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2704. \def\defcvarheader #1#2#3{%
  2705. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2706. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2707. \defvarargs {#3}\endgroup %
  2708. % @defivar == @defcv {Instance Variable}
  2709. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2710. \def\defivarheader #1#2#3{%
  2711. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2712. \begingroup\defname {#2}{Instance Variable of #1}%
  2713. \defvarargs {#3}\endgroup %
  2714. % These definitions are run if you use @defmethodx, etc.,
  2715. % anywhere other than immediately after a @defmethod, etc.
  2716. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2717. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2718. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2719. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2720. % Now @defvar
  2721. % First, define the processing that is wanted for arguments of @defvar.
  2722. % This is actually simple: just print them in roman.
  2723. % This must expand the args and terminate the paragraph they make up
  2724. \def\defvarargs #1{\normalparens #1%
  2725. \interlinepenalty=10000
  2726. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2727. % @defvr Counter foo-count
  2728. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2729. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2730. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2731. % @defvar == @defvr Variable
  2732. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2733. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2734. \begingroup\defname {#1}{Variable}%
  2735. \defvarargs {#2}\endgroup %
  2736. % @defopt == @defvr {User Option}
  2737. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2738. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2739. \begingroup\defname {#1}{User Option}%
  2740. \defvarargs {#2}\endgroup %
  2741. % @deftypevar int foobar
  2742. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2743. % #1 is the data type.  #2 is the name.
  2744. \def\deftypevarheader #1#2{%
  2745. \doind {vr}{\code{#2}}% Make entry in variables index
  2746. \begingroup\defname {\code{#1} #2}{Variable}%
  2747. \interlinepenalty=10000
  2748. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2749. \endgroup}
  2750. % @deftypevr {Global Flag} int enable
  2751. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2752. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2753. \begingroup\defname {\code{#2} #3}{#1}
  2754. \interlinepenalty=10000
  2755. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2756. \endgroup}
  2757. % This definition is run if you use @defvarx
  2758. % anywhere other than immediately after a @defvar or @defvarx.
  2759. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2760. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2761. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2762. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2763. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2764. % Now define @deftp
  2765. % Args are printed in bold, a slight difference from @defvar.
  2766. \def\deftpargs #1{\bf \defvarargs{#1}}
  2767. % @deftp Class window height width ...
  2768. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  2769. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2770. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2771. % This definition is run if you use @deftpx, etc
  2772. % anywhere other than immediately after a @deftp, etc.
  2773. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2774. \message{cross reference,}
  2775. % Define cross-reference macros
  2776. \newwrite \auxfile
  2777. \newif\ifhavexrefs  % True if xref values are known.
  2778. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2779. % \setref{foo} defines a cross-reference point named foo.
  2780. \def\setref#1{%
  2781. \dosetq{#1-title}{Ytitle}%
  2782. \dosetq{#1-pg}{Ypagenumber}%
  2783. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2784. \def\unnumbsetref#1{%
  2785. \dosetq{#1-title}{Ytitle}%
  2786. \dosetq{#1-pg}{Ypagenumber}%
  2787. \dosetq{#1-snt}{Ynothing}}
  2788. \def\appendixsetref#1{%
  2789. \dosetq{#1-title}{Ytitle}%
  2790. \dosetq{#1-pg}{Ypagenumber}%
  2791. \dosetq{#1-snt}{Yappendixletterandtype}}
  2792. % \xref, \pxref, and \ref generate cross-references to specified points.
  2793. % For \xrefX, #1 is the node name, #2 the name of the Info
  2794. % cross-reference, #3 the printed node name, #4 the name of the Info
  2795. % file, #5 the name of the printed manual.  All but the node name can be
  2796. % omitted.
  2797. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2798. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2799. \def\ref#1{\xrefX[#1,,,,,,,]}
  2800. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2801. \def\printedmanual{\ignorespaces #5}%
  2802. \def\printednodename{\ignorespaces #3}%
  2803. \setbox1=\hbox{\printedmanual}%
  2804. \setbox0=\hbox{\printednodename}%
  2805. \ifdim \wd0=0pt%
  2806. % No printed node name was explicitly given.
  2807. \ifx SETxref-automatic-section-title %
  2808. % This line should make the actual chapter or section title appear inside
  2809. % the square brackets.  Use the real section title if we have it.
  2810. \ifdim \wd1>0pt%
  2811. % It is in another manual, so we don't have it.
  2812. \def\printednodename{\ignorespaces #1} \else%
  2813. % We know the real title if we have the xref values.
  2814. \ifhavexrefs \def\printednodename{\refx{#1-title}}%
  2815. % Otherwise just copy the Info node name.
  2816. \else \def\printednodename{\ignorespaces #1} \fi%
  2817. \fi\def\printednodename{#1-title}%
  2818. \else% This line just uses the node name.
  2819. \def\printednodename{\ignorespaces #1}%
  2820. \fi% ends \ifx SETxref-automatic-section-title
  2821. \fi% ends \ifdim \wd0
  2822. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2823. % not insert empty discretionaries after hyphens, which means that it
  2824. % will not find a line break at a hyphen in a node names.  Since some
  2825. % manuals are best written with fairly long node names, containing
  2826. % hyphens, this is a loss.  Therefore, we simply give the text of
  2827. % the node name again, so it is as if TeX is seeing it for the first
  2828. % time.
  2829. \ifdim \wd1>0pt
  2830. section ``\printednodename'' in \cite{\printedmanual}%
  2831. \else%
  2832. \turnoffactive%
  2833. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2834. \endgroup}
  2835. % \dosetq is the interface for calls from other macros
  2836. % Use \turnoffactive so that punctuation chars such as underscore
  2837. % work in node names.
  2838. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2839. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2840. \next}}
  2841. % \internalsetq {foo}{page} expands into
  2842. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2843. % When the aux file is read, ' is the escape character
  2844. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2845. % Things to be expanded by \internalsetq
  2846. \def\Ypagenumber{\folio}
  2847. \def\Ytitle{\thissection}
  2848. \def\Ynothing{}
  2849. \def\Ysectionnumberandtype{%
  2850. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2851. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2852. \else \ifnum \subsubsecno=0 %
  2853. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2854. \else %
  2855. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2856. \fi \fi \fi }
  2857. \def\Yappendixletterandtype{%
  2858. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
  2859. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2860. \else \ifnum \subsubsecno=0 %
  2861. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2862. \else %
  2863. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2864. \fi \fi \fi }
  2865. \gdef\xreftie{'tie}
  2866. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2867. % messages, but if we're using an old version of TeX, don't do anything.
  2868. \ifx\inputlineno\thisisundefined
  2869.   \let\linenumber = \empty % Non-3.0.
  2870. \else
  2871.   \def\linenumber{\the\inputlineno:\space}
  2872. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2873. % If its value is nonempty, SUFFIX is output afterward.
  2874. \def\refx#1#2{%
  2875.   \expandafter\ifx\csname X#1\endcsname\relax
  2876.     % If not defined, say something at least.
  2877.     $\langle$un\-de\-fined$\rangle$%
  2878.     \ifhavexrefs
  2879.       \message{\linenumber Undefined cross reference `#1'.}%
  2880.     \else
  2881.       \ifwarnedxrefs\else
  2882.         \global\warnedxrefstrue
  2883.         \message{Cross reference values unknown; you must run TeX again.}%
  2884.       \fi
  2885.     \fi
  2886.   \else
  2887.     % It's defined, so just use it.
  2888.     \csname X#1\endcsname
  2889.   \fi
  2890.   #2% Output the suffix in any case.
  2891. % Read the last existing aux file, if any.  No error if none exists.
  2892. % This is the macro invoked by entries in the aux file.
  2893. \def\xrdef #1#2{
  2894. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2895. \def\readauxfile{%
  2896. \begingroup
  2897. \catcode `\^^@=\other
  2898. \catcode `\
  2899. =\other
  2900. \catcode `\
  2901. =\other
  2902. \catcode `\^^C=\other
  2903. \catcode `\^^D=\other
  2904. \catcode `\^^E=\other
  2905. \catcode `\^^F=\other
  2906. \catcode `\^^G=\other
  2907. \catcode `\^^H=\other
  2908. \catcode `\
  2909. =\other
  2910. \catcode `\^^L=\other
  2911. \catcode `\
  2912. =\other
  2913. \catcode `\
  2914. =\other
  2915. \catcode `\
  2916. =\other
  2917. \catcode `\
  2918. =\other
  2919. \catcode `\
  2920. =\other
  2921. \catcode `\
  2922. =\other
  2923. \catcode `\
  2924. =\other
  2925. \catcode `\
  2926. =\other
  2927. \catcode `\
  2928. =\other
  2929. \catcode `\
  2930. =\other
  2931. \catcode `\
  2932. =\other
  2933. \catcode `\
  2934. =\other
  2935. \catcode 26=\other
  2936. \catcode `\^^[=\other
  2937. \catcode `\^^\=\other
  2938. \catcode `\^^]=\other
  2939. \catcode `\^^^=\other
  2940. \catcode `\^^_=\other
  2941. \catcode `\@=\other
  2942. \catcode `\^=\other
  2943. \catcode `\~=\other
  2944. \catcode `\[=\other
  2945. \catcode `\]=\other
  2946. \catcode`\"=\other
  2947. \catcode`\_=\other
  2948. \catcode`\|=\other
  2949. \catcode`\<=\other
  2950. \catcode`\>=\other
  2951. \catcode `\$=\other
  2952. \catcode `\#=\other
  2953. \catcode `\&=\other
  2954. % `\+ does not work, so use 43.
  2955. \catcode 43=\other
  2956. % the aux file uses ' as the escape.
  2957. % Turn off \ as an escape so we do not lose on
  2958. % entries which were dumped with control sequences in their names.
  2959. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2960. % Reference to such entries still does not work the way one would wish,
  2961. % but at least they do not bomb out when the aux file is read in.
  2962. \catcode `\{=1 \catcode `\}=2
  2963. \catcode `\%=\other
  2964. \catcode `\'=0
  2965. \catcode `\\=\other
  2966. \openin 1 \jobname.aux
  2967. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2968. \global\warnedobstrue
  2969. % Open the new aux file.  Tex will close it automatically at exit.
  2970. \openout \auxfile=\jobname.aux
  2971. \endgroup}
  2972. % Footnotes.
  2973. \newcount \footnoteno
  2974. % The trailing space in the following definition for supereject is
  2975. % vital for proper filling; pages come out unaligned when you do a
  2976. % pagealignmacro call if that space before the closing brace is
  2977. % removed.
  2978. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2979. % @footnotestyle is meaningful for info output only..
  2980. \let\footnotestyle=\comment
  2981. \let\ptexfootnote=\footnote
  2982. {\catcode `\@=11
  2983. % Auto-number footnotes.  Otherwise like plain.
  2984. \gdef\footnote{%
  2985.   \global\advance\footnoteno by \@ne
  2986.   \edef\thisfootno{$^{\the\footnoteno}$}%
  2987.   % In case the footnote comes at the end of a sentence, preserve the
  2988.   % extra spacing after we do the footnote number.
  2989.   \let\@sf\empty
  2990.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2991.   % Remove inadvertent blank space before typesetting the footnote number.
  2992.   \unskip
  2993.   \thisfootno\@sf
  2994.   \footnotezzz
  2995. % Don't bother with the trickery in plain.tex to not require the
  2996. % footnote text as a parameter.  Our footnotes don't need to be so general.
  2997. \long\gdef\footnotezzz#1{\insert\footins{%
  2998.   % We want to typeset this text as a normal paragraph, even if the
  2999.   % footnote reference occurs in (for example) a display environment.
  3000.   % So reset some parameters.
  3001.   \interlinepenalty\interfootnotelinepenalty
  3002.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  3003.   \splitmaxdepth\dp\strutbox
  3004.   \floatingpenalty\@MM
  3005.   \leftskip\z@skip
  3006.   \rightskip\z@skip
  3007.   \spaceskip\z@skip
  3008.   \xspaceskip\z@skip
  3009.   \parindent\defaultparindent
  3010.   % Hang the footnote text off the number.
  3011.   \hang
  3012.   \textindent{\thisfootno}%
  3013.   % Don't crash into the line above the footnote text.  Since this
  3014.   % expands into a box, it must come within the paragraph, lest it
  3015.   % provide a place where TeX can split the footnote.
  3016.   \footstrut
  3017.   #1\strut}%
  3018. }%end \catcode `\@=11
  3019. % Set the baselineskip to #1, and the lineskip and strut size
  3020. % correspondingly.  There is no deep meaning behind these magic numbers
  3021. % used as factors; they just match (closely enough) what Knuth defined.
  3022. \def\lineskipfactor{.08333}
  3023. \def\strutheightpercent{.70833}
  3024. \def\strutdepthpercent {.29167}
  3025. \def\setleading#1{%
  3026.   \normalbaselineskip = #1\relax
  3027.   \normallineskip = \lineskipfactor\normalbaselineskip
  3028.   \normalbaselines
  3029.   \setbox\strutbox =\hbox{%
  3030.     \vrule width0pt height\strutheightpercent\baselineskip
  3031.                     depth \strutdepthpercent \baselineskip
  3032. % @| inserts a changebar to the left of the current line.  It should
  3033. % surround any changed text.  This approach does *not* work if the
  3034. % change spans more than two lines of output.  To handle that, we would
  3035. % have adopt a much more difficult approach (putting marks into the main
  3036. % vertical list for the beginning and end of each change).
  3037. \def\|{%
  3038.   % \vadjust can only be used in horizontal mode.
  3039.   \leavevmode
  3040.   % Append this vertical mode material after the current line in the output.
  3041.   \vadjust{%
  3042.     % We want to insert a rule with the height and depth of the current
  3043.     % leading; that is exactly what \strutbox is supposed to record.
  3044.     \vskip-\baselineskip
  3045.     %
  3046.     % \vadjust-items are inserted at the left edge of the type.  So
  3047.     % the \llap here moves out into the left-hand margin.
  3048.     \llap{%
  3049.       %
  3050.       % For a thicker or thinner bar, change the `1pt'.
  3051.       \vrule height\baselineskip width1pt
  3052.       %
  3053.       % This is the space between the bar and the text.
  3054.       \hskip 12pt
  3055.     }%
  3056. % For a final copy, take out the rectangles
  3057. % that mark overfull boxes (in case you have decided
  3058. % that the text looks ok even though it passes the margin).
  3059. \def\finalout{\overfullrule=0pt}
  3060. % End of control word definitions.
  3061. \message{and turning on texinfo input format.}
  3062. \def\openindices{%
  3063.    \newindex{cp}%
  3064.    \newcodeindex{fn}%
  3065.    \newcodeindex{vr}%
  3066.    \newcodeindex{tp}%
  3067.    \newcodeindex{ky}%
  3068.    \newcodeindex{pg}%
  3069. % Set some numeric style parameters, for 8.5 x 11 format.
  3070. %\hsize = 6.5in
  3071. \newdimen\defaultparindent \defaultparindent = 15pt
  3072. \parindent = \defaultparindent
  3073. \parskip 18pt plus 1pt
  3074. \setleading{15pt}
  3075. \advance\topskip by 1.2cm
  3076. % Prevent underfull vbox error messages.
  3077. \vbadness=10000
  3078. % Following George Bush, just get rid of widows and orphans.
  3079. \widowpenalty=10000
  3080. \clubpenalty=10000
  3081. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  3082. % using an old version of TeX, don't do anything.  We want the amount of
  3083. % stretch added to depend on the line length, hence the dependence on
  3084. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  3085. \ifx\emergencystretch\thisisundefined
  3086.   % Allow us to assign to \emergencystretch anyway.
  3087.   \def\emergencystretch{\dimen0}%
  3088. \else
  3089.   \emergencystretch = \hsize
  3090.   \divide\emergencystretch by 45
  3091. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  3092. \def\smallbook{
  3093. % These values for secheadingskip and subsecheadingskip are
  3094. % experiments.  RJC 7 Aug 1992
  3095. \global\secheadingskip = 17pt plus 6pt minus 3pt
  3096. \global\subsecheadingskip = 14pt plus 6pt minus 3pt
  3097. \global\lispnarrowing = 0.3in
  3098. \setleading{12pt}
  3099. \advance\topskip by -1cm
  3100. \global\parskip 3pt plus 1pt
  3101. \global\hsize = 5in
  3102. \global\vsize=7.5in
  3103. \global\tolerance=700
  3104. \global\hfuzz=1pt
  3105. \global\contentsrightmargin=0pt
  3106. \global\pagewidth=\hsize
  3107. \global\pageheight=\vsize
  3108. \global\let\smalllisp=\smalllispx
  3109. \global\let\smallexample=\smalllispx
  3110. \global\def\Esmallexample{\Esmalllisp}
  3111. % Use @afourpaper to print on European A4 paper.
  3112. \def\afourpaper{
  3113. \global\tolerance=700
  3114. \global\hfuzz=1pt
  3115. \setleading{12pt}
  3116. \global\parskip 15pt plus 1pt
  3117. \global\vsize= 53\baselineskip
  3118. \advance\vsize by \topskip
  3119. %\global\hsize=   5.85in     % A4 wide 10pt
  3120. \global\hsize=  6.5in
  3121. \global\outerhsize=\hsize
  3122. \global\advance\outerhsize by 0.5in
  3123. \global\outervsize=\vsize
  3124. \global\advance\outervsize by 0.6in
  3125. \global\pagewidth=\hsize
  3126. \global\pageheight=\vsize
  3127. % Define macros to output various characters with catcode for normal text.
  3128. \catcode`\"=\other
  3129. \catcode`\~=\other
  3130. \catcode`\^=\other
  3131. \catcode`\_=\other
  3132. \catcode`\|=\other
  3133. \catcode`\<=\other
  3134. \catcode`\>=\other
  3135. \catcode`\+=\other
  3136. \def\normaldoublequote{"}
  3137. \def\normaltilde{~}
  3138. \def\normalcaret{^}
  3139. \def\normalunderscore{_}
  3140. \def\normalverticalbar{|}
  3141. \def\normalless{<}
  3142. \def\normalgreater{>}
  3143. \def\normalplus{+}
  3144. % This macro is used to make a character print one way in ttfont
  3145. % where it can probably just be output, and another way in other fonts,
  3146. % where something hairier probably needs to be done.
  3147. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3148. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3149. % interword stretch (and shrink), and it is reasonable to expect all
  3150. % typewriter fonts to have this, we can check that font parameter.
  3151. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3152. % Turn off all special characters except @
  3153. % (and those which the user can use as if they were ordinary).
  3154. % Most of these we simply print from the \tt font, but for some, we can
  3155. % use math or other variants that look better in normal text.
  3156. \catcode`\"=\active
  3157. \def\activedoublequote{{\tt \char '042}}
  3158. \let"=\activedoublequote
  3159. \catcode`\~=\active
  3160. \def~{{\tt \char '176}}
  3161. \chardef\hat=`\^
  3162. \catcode`\^=\active
  3163. \def^{{\tt \hat}}
  3164. \catcode`\_=\active
  3165. \def_{\ifusingtt\normalunderscore\_}
  3166. % Subroutine for the previous macro.
  3167. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3168. % \lvvmode is equivalent in function to \leavevmode.
  3169. % Using \leavevmode runs into trouble when written out to
  3170. % an index file due to the expansion of \leavevmode into ``\unhbox
  3171. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3172. % magic tricks with @.
  3173. \def\lvvmode{\vbox to 0pt{}}
  3174. \catcode`\|=\active
  3175. \def|{{\tt \char '174}}
  3176. \chardef \less=`\<
  3177. \catcode`\<=\active
  3178. \def<{{\tt \less}}
  3179. \chardef \gtr=`\>
  3180. \catcode`\>=\active
  3181. \def>{{\tt \gtr}}
  3182. \catcode`\+=\active
  3183. \def+{{\tt \char 43}}
  3184. %\catcode 27=\active
  3185. %\def^^[{$\diamondsuit$}
  3186. % Used sometimes to turn off (effectively) the active characters
  3187. % even after parsing them.
  3188. \def\turnoffactive{\let"=\normaldoublequote
  3189. \let~=\normaltilde
  3190. \let^=\normalcaret
  3191. \let_=\normalunderscore
  3192. \let|=\normalverticalbar
  3193. \let<=\normalless
  3194. \let>=\normalgreater
  3195. \let+=\normalplus}
  3196. % Set up an active definition for =, but don't enable it most of the time.
  3197. {\catcode`\==\active
  3198. \global\def={{\tt \char 61}}}
  3199. \catcode`\@=0
  3200. % \rawbackslashxx output one backslash character in current font
  3201. \global\chardef\rawbackslashxx=`\\
  3202. %{\catcode`\\=\other
  3203. %@gdef@rawbackslashxx{\}}
  3204. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3205. {\catcode`\\=\active
  3206. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3207. % \normalbackslash outputs one backslash in fixed width font.
  3208. \def\normalbackslash{{\tt\rawbackslashxx}}
  3209. % Say @foo, not \foo, in error messages.
  3210. \escapechar=`\@
  3211. % \catcode 17=0   % Define control-q
  3212. \catcode`\\=\active
  3213. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3214. % That is what \eatinput is for; after that, the `\' should revert to printing
  3215. % a backslash.
  3216. @gdef@eatinput input texinfo{@fixbackslash}
  3217. @global@let\ = @eatinput
  3218. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3219. % the first `\{ in the file would cause an error. This macro tries to fix
  3220. % that, assuming it is called before the first `\' could plausibly occur.
  3221. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3222. %% These look ok in all fonts, so just make them not special.  The @rm below
  3223. %% makes sure that the current font starts out as the newly loaded cmr10
  3224. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3225. @textfonts
  3226. @c Local variables:
  3227. @c page-delimiter: "^\\\\message"
  3228. @c End:
  3229.